ViewMode constants; default view modes
parent
90c2de44c3
commit
8633e9677b
|
@ -154,7 +154,7 @@ func Parse(c *caddy.Controller, plugin string) ([]*filemanager.FileManager, erro
|
||||||
}
|
}
|
||||||
|
|
||||||
u.ViewMode = c.Val()
|
u.ViewMode = c.Val()
|
||||||
if u.ViewMode != "mosaic" && u.ViewMode != "list" {
|
if u.ViewMode != filemanager.MosaicViewMode && u.ViewMode != filemanager.ListViewMode {
|
||||||
return nil, c.ArgErr()
|
return nil, c.ArgErr()
|
||||||
}
|
}
|
||||||
case "recaptcha_key":
|
case "recaptcha_key":
|
||||||
|
|
|
@ -85,7 +85,7 @@ func setupViper() {
|
||||||
viper.SetDefault("NoAuth", false)
|
viper.SetDefault("NoAuth", false)
|
||||||
viper.SetDefault("BaseURL", "")
|
viper.SetDefault("BaseURL", "")
|
||||||
viper.SetDefault("PrefixURL", "")
|
viper.SetDefault("PrefixURL", "")
|
||||||
viper.SetDefault("ViewMode", "mosaic")
|
viper.SetDefault("ViewMode", filemanager.MosaicViewMode)
|
||||||
viper.SetDefault("ReCaptchaKey", "")
|
viper.SetDefault("ReCaptchaKey", "")
|
||||||
viper.SetDefault("ReCaptchaSecret", "")
|
viper.SetDefault("ReCaptchaSecret", "")
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version is the current File Manager version.
|
// Version is the current File Manager version.
|
||||||
const Version = "(untracked)"
|
const (
|
||||||
|
// Version is the current File Manager version.
|
||||||
|
Version = "(untracked)"
|
||||||
|
|
||||||
|
ListViewMode = "list"
|
||||||
|
MosaicViewMode = "mosaic"
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrExist = errors.New("the resource already exists")
|
ErrExist = errors.New("the resource already exists")
|
||||||
|
@ -207,8 +213,8 @@ func (m *FileManager) Setup() error {
|
||||||
|
|
||||||
// TODO: remove this after 1.5
|
// TODO: remove this after 1.5
|
||||||
for _, user := range users {
|
for _, user := range users {
|
||||||
if user.ViewMode != "list" && user.ViewMode != "mosaic" {
|
if user.ViewMode != ListViewMode && user.ViewMode != MosaicViewMode {
|
||||||
user.ViewMode = "list"
|
user.ViewMode = ListViewMode
|
||||||
m.Store.Users.Update(user, "ViewMode")
|
m.Store.Users.Update(user, "ViewMode")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,6 +182,7 @@ func usersPostHandler(c *fm.Context, w http.ResponseWriter, r *http.Request) (in
|
||||||
}
|
}
|
||||||
|
|
||||||
u.Password = pw
|
u.Password = pw
|
||||||
|
u.ViewMode = fm.MosaicViewMode
|
||||||
|
|
||||||
// Saves the user to the database.
|
// Saves the user to the database.
|
||||||
err = c.Store.Users.Save(u)
|
err = c.Store.Users.Save(u)
|
||||||
|
|
Loading…
Reference in New Issue