forked from forgejo/forgejo
Allow for user specific themes (#5668)
* add migration and basic UI for changing a user's theme * update user themem * use right text on button * load theme based on users' selection * load theme based on users' selection in pwa too * update sample config * delete older theme loading * implement AfterLoad to set users' theme properly * set up default theme when creating a user. This uses the installation wide theme * use flash messages for error * set default theme when creating a user from the cli * fix @lunny review
This commit is contained in:
parent
ea518681d9
commit
8d2c24f7f9
14 changed files with 157 additions and 11 deletions
|
@ -18,7 +18,7 @@ import (
|
|||
"github.com/Unknwon/com"
|
||||
"github.com/go-xorm/xorm"
|
||||
gouuid "github.com/satori/go.uuid"
|
||||
"gopkg.in/ini.v1"
|
||||
ini "gopkg.in/ini.v1"
|
||||
|
||||
"code.gitea.io/gitea/modules/generate"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
|
@ -206,6 +206,8 @@ var migrations = []Migration{
|
|||
NewMigration("clear nonused data which not deleted when user was deleted", clearNonusedData),
|
||||
// v76 -> v77
|
||||
NewMigration("add pull request rebase with merge commit", addPullRequestRebaseWithMerge),
|
||||
// v77 -> v78
|
||||
NewMigration("add theme to users", addUserDefaultTheme),
|
||||
}
|
||||
|
||||
// Migrate database to current version
|
||||
|
|
17
models/migrations/v77.go
Normal file
17
models/migrations/v77.go
Normal file
|
@ -0,0 +1,17 @@
|
|||
// Copyright 2019 The Gitea Authors. All rights reserved.
|
||||
// Use of this source code is governed by a MIT-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"github.com/go-xorm/xorm"
|
||||
)
|
||||
|
||||
func addUserDefaultTheme(x *xorm.Engine) error {
|
||||
type User struct {
|
||||
Theme string `xorm:"VARCHAR(30)"`
|
||||
}
|
||||
|
||||
return x.Sync2(new(User))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue