From 2e86ac7bb29d5ea1c20abeff8f5611a89f649a5e Mon Sep 17 00:00:00 2001 From: Mickael Kerjean Date: Sun, 19 Sep 2021 14:04:11 +1000 Subject: [PATCH] improve (admin): additional customisations on admin console --- client/pages/adminpage.scss | 4 +-- client/pages/filespage.js | 4 +-- server/common/config.go | 54 ++++++++++++++++++++----------------- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/client/pages/adminpage.scss b/client/pages/adminpage.scss index b61f16d5..ba7ea03a 100644 --- a/client/pages/adminpage.scss +++ b/client/pages/adminpage.scss @@ -101,7 +101,7 @@ transition-delay: 0.7s; h2{ font-family: 'Source Code Pro', monospace; - color: var(--primary); + color: white; font-weight: 300; font-size: 1.5em; margin: 25px 0 40px 0; @@ -116,7 +116,7 @@ overflow: hidden; text-overflow: ellipsis; a.active, a:hover{ - color: var(--primary); + color: white; } } } diff --git a/client/pages/filespage.js b/client/pages/filespage.js index eb29b42b..21416108 100644 --- a/client/pages/filespage.js +++ b/client/pages/filespage.js @@ -36,10 +36,10 @@ export class FilesPage extends React.Component { } this.state = { path: (decodeURIComponent(location.pathname).replace("/files", "") || "/" ), - sort: settings_get("filespage_sort") || "type", + sort: settings_get("filespage_sort") || CONFIG["default_sort"] || "type", sort_reverse: true, show_hidden: settings_get("filespage_show_hidden") || CONFIG["display_hidden"], - view: settings_get("filespage_view") || "grid", + view: settings_get("filespage_view") || CONFIG["default_view"] || "grid", is_search: false, files: [], selected: [], diff --git a/server/common/config.go b/server/common/config.go index 7ff57653..4410def9 100644 --- a/server/common/config.go +++ b/server/common/config.go @@ -81,6 +81,8 @@ func NewConfiguration() Configuration { FormElement{Name: "auto_connect", Type: "boolean", Default: false, Description: "User don't have to click on the login button if an admin is prefilling a unique backend"}, FormElement{Name: "upload_button", Type: "boolean", Default: false, Description: "Display the upload button on any device"}, FormElement{Name: "upload_pool_size", Type: "number", Default: 15, Description: "Maximum number of files upload in parallel (Default: 15)"}, + FormElement{Name: "filepage_default_view", Type: "select", Default: "grid", Opts: []string{"list", "grid"}, Description: "Default layout for files and folder on the file page"}, + FormElement{Name: "filepage_default_sort", Type: "select", Default: "type", Opts: []string{"type", "date", "name"}, Description: "Default order for files and folder on the file page"}, FormElement{Name: "custom_css", Type: "long_text", Default: "", Description: "Set custom css code for your instance"}, }, }, @@ -351,31 +353,35 @@ func (this Configuration) Save() Configuration { func (this Configuration) Export() interface{} { return struct { - Editor string `json:"editor"` - ForkButton bool `json:"fork_button"` - DisplayHidden bool `json:"display_hidden"` - AutoConnect bool `json:"auto_connect"` - Name string `json:"name"` - UploadButton bool `json:"upload_button"` - Connections interface{} `json:"connections"` - EnableShare bool `json:"enable_share"` - Logout string `json:"logout"` - MimeTypes map[string]string `json:"mime"` - UploadPoolSize int `json:"upload_pool_size"` - RefreshAfterUpload bool `json:"refresh_after_upload"` + Editor string `json:"editor"` + ForkButton bool `json:"fork_button"` + DisplayHidden bool `json:"display_hidden"` + AutoConnect bool `json:"auto_connect"` + Name string `json:"name"` + UploadButton bool `json:"upload_button"` + Connections interface{} `json:"connections"` + EnableShare bool `json:"enable_share"` + Logout string `json:"logout"` + MimeTypes map[string]string `json:"mime"` + UploadPoolSize int `json:"upload_pool_size"` + RefreshAfterUpload bool `json:"refresh_after_upload"` + FilePageDefaultSort string `json:"default_sort"` + FilePageDefaultView string `json:"default_view"` }{ - Editor: this.Get("general.editor").String(), - ForkButton: this.Get("general.fork_button").Bool(), - DisplayHidden: this.Get("general.display_hidden").Bool(), - AutoConnect: this.Get("general.auto_connect").Bool(), - Name: this.Get("general.name").String(), - UploadButton: this.Get("general.upload_button").Bool(), - Connections: this.Conn, - EnableShare: this.Get("features.share.enable").Bool(), - Logout: this.Get("general.logout").String(), - MimeTypes: AllMimeTypes(), - UploadPoolSize: this.Get("general.upload_pool_size").Int(), - RefreshAfterUpload: this.Get("general.refresh_after_upload").Bool(), + Editor: this.Get("general.editor").String(), + ForkButton: this.Get("general.fork_button").Bool(), + DisplayHidden: this.Get("general.display_hidden").Bool(), + AutoConnect: this.Get("general.auto_connect").Bool(), + Name: this.Get("general.name").String(), + UploadButton: this.Get("general.upload_button").Bool(), + Connections: this.Conn, + EnableShare: this.Get("features.share.enable").Bool(), + Logout: this.Get("general.logout").String(), + MimeTypes: AllMimeTypes(), + UploadPoolSize: this.Get("general.upload_pool_size").Int(), + RefreshAfterUpload: this.Get("general.refresh_after_upload").Bool(), + FilePageDefaultSort: this.Get("general.filepage_default_sort").String(), + FilePageDefaultView: this.Get("general.filepage_default_view").String(), } }