Rename column to CategoriesSortingOrder

This commit is contained in:
Frédéric Guillot 2022-10-25 20:00:56 -07:00
parent 83e1f154b5
commit 206be5ba15
26 changed files with 178 additions and 179 deletions

View file

@ -18,28 +18,28 @@ const (
// User represents a user in the system.
type User struct {
ID int64 `json:"id"`
Username string `json:"username"`
Password string `json:"password,omitempty"`
IsAdmin bool `json:"is_admin"`
Theme string `json:"theme"`
Language string `json:"language"`
Timezone string `json:"timezone"`
EntryDirection string `json:"entry_sorting_direction"`
EntryOrder string `json:"entry_sorting_order"`
Stylesheet string `json:"stylesheet"`
GoogleID string `json:"google_id"`
OpenIDConnectID string `json:"openid_connect_id"`
EntriesPerPage int `json:"entries_per_page"`
KeyboardShortcuts bool `json:"keyboard_shortcuts"`
ShowReadingTime bool `json:"show_reading_time"`
EntrySwipe bool `json:"entry_swipe"`
LastLoginAt *time.Time `json:"last_login_at"`
DisplayMode string `json:"display_mode"`
DefaultReadingSpeed int `json:"default_reading_speed"`
CJKReadingSpeed int `json:"cjk_reading_speed"`
DefaultHomePage string `json:"default_home_page"`
CategoriesSortOrder string `json:"categories_sort_order"`
ID int64 `json:"id"`
Username string `json:"username"`
Password string `json:"password,omitempty"`
IsAdmin bool `json:"is_admin"`
Theme string `json:"theme"`
Language string `json:"language"`
Timezone string `json:"timezone"`
EntryDirection string `json:"entry_sorting_direction"`
EntryOrder string `json:"entry_sorting_order"`
Stylesheet string `json:"stylesheet"`
GoogleID string `json:"google_id"`
OpenIDConnectID string `json:"openid_connect_id"`
EntriesPerPage int `json:"entries_per_page"`
KeyboardShortcuts bool `json:"keyboard_shortcuts"`
ShowReadingTime bool `json:"show_reading_time"`
EntrySwipe bool `json:"entry_swipe"`
LastLoginAt *time.Time `json:"last_login_at"`
DisplayMode string `json:"display_mode"`
DefaultReadingSpeed int `json:"default_reading_speed"`
CJKReadingSpeed int `json:"cjk_reading_speed"`
DefaultHomePage string `json:"default_home_page"`
CategoriesSortingOrder string `json:"categories_sorting_order"`
}
func (u User) String() string {
@ -57,26 +57,26 @@ type UserCreationRequest struct {
// UserModificationRequest represents the request to update a user.
type UserModificationRequest struct {
Username *string `json:"username"`
Password *string `json:"password"`
IsAdmin *bool `json:"is_admin"`
Theme *string `json:"theme"`
Language *string `json:"language"`
Timezone *string `json:"timezone"`
EntryDirection *string `json:"entry_sorting_direction"`
EntryOrder *string `json:"entry_sorting_order"`
Stylesheet *string `json:"stylesheet"`
GoogleID *string `json:"google_id"`
OpenIDConnectID *string `json:"openid_connect_id"`
EntriesPerPage *int `json:"entries_per_page"`
KeyboardShortcuts *bool `json:"keyboard_shortcuts"`
ShowReadingTime *bool `json:"show_reading_time"`
EntrySwipe *bool `json:"entry_swipe"`
DisplayMode *string `json:"display_mode"`
DefaultReadingSpeed *int `json:"default_reading_speed"`
CJKReadingSpeed *int `json:"cjk_reading_speed"`
DefaultHomePage *string `json:"default_home_page"`
CategoriesSortOrder *string `json:"categories_sort_order"`
Username *string `json:"username"`
Password *string `json:"password"`
IsAdmin *bool `json:"is_admin"`
Theme *string `json:"theme"`
Language *string `json:"language"`
Timezone *string `json:"timezone"`
EntryDirection *string `json:"entry_sorting_direction"`
EntryOrder *string `json:"entry_sorting_order"`
Stylesheet *string `json:"stylesheet"`
GoogleID *string `json:"google_id"`
OpenIDConnectID *string `json:"openid_connect_id"`
EntriesPerPage *int `json:"entries_per_page"`
KeyboardShortcuts *bool `json:"keyboard_shortcuts"`
ShowReadingTime *bool `json:"show_reading_time"`
EntrySwipe *bool `json:"entry_swipe"`
DisplayMode *string `json:"display_mode"`
DefaultReadingSpeed *int `json:"default_reading_speed"`
CJKReadingSpeed *int `json:"cjk_reading_speed"`
DefaultHomePage *string `json:"default_home_page"`
CategoriesSortingOrder *string `json:"categories_sorting_order"`
}
// Users represents a list of users.

View file

@ -618,7 +618,7 @@ var migrations = []func(tx *sql.Tx) error{
},
func(tx *sql.Tx) (err error) {
_, err = tx.Exec(`
ALTER TABLE users ADD COLUMN categories_sort_order text not null default 'unread_count';
ALTER TABLE users ADD COLUMN categories_sorting_order text not null default 'unread_count';
`)
return
},

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "Benutzerdefiniertes CSS",
"form.prefs.label.entry_order": "Eintrag Sortierspalte",
"form.prefs.label.default_home_page": "Standard Startseite",
"form.prefs.label.categories_sort_order": "Kategorien sortieren",
"form.prefs.label.categories_sorting_order": "Kategorien sortieren",
"form.import.label.file": "OPML Datei",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Fever API aktivieren",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "Προσαρμοσμένο CSS",
"form.prefs.label.entry_order": "Στήλη ταξινόμησης εισόδου",
"form.prefs.label.default_home_page": "Προεπιλεγμένη αρχική σελίδα",
"form.prefs.label.categories_sort_order": "Ταξινόμηση κατηγοριών",
"form.prefs.label.categories_sorting_order": "Ταξινόμηση κατηγοριών",
"form.import.label.file": "Αρχείο OPML",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Ενεργοποιήστε το Fever API",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "Custom CSS",
"form.prefs.label.entry_order": "Entry Sorting Column",
"form.prefs.label.default_home_page": "Default home page",
"form.prefs.label.categories_sort_order": "Categories Sorting",
"form.prefs.label.categories_sorting_order": "Categories Sorting",
"form.import.label.file": "OPML file",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Activate Fever API",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "CSS personalizado",
"form.prefs.label.entry_order": "Columna de clasificación de entradas",
"form.prefs.label.default_home_page": "Página de inicio por defecto",
"form.prefs.label.categories_sort_order": "Clasificación por categorías",
"form.prefs.label.categories_sorting_order": "Clasificación por categorías",
"form.import.label.file": "Archivo OPML",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Activar API de Fever",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "Mukautettu CSS",
"form.prefs.label.entry_order": "Lajittele sarakkeen mukaan",
"form.prefs.label.default_home_page": "Oletusarvoinen etusivu",
"form.prefs.label.categories_sort_order": "Kategorioiden lajittelu",
"form.prefs.label.categories_sorting_order": "Kategorioiden lajittelu",
"form.import.label.file": "OPML-tiedosto",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Ota Fever API käyttöön",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "CSS personnalisé",
"form.prefs.label.entry_order": "Colonne de tri des entrées",
"form.prefs.label.default_home_page": "Page d'accueil par défaut",
"form.prefs.label.categories_sort_order": "Colonne de tri des catégories",
"form.prefs.label.categories_sorting_order": "Colonne de tri des catégories",
"form.import.label.file": "Fichier OPML",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Activer l'API de Fever",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "कस्टम सीएसएस",
"form.prefs.label.entry_order": "प्रवेश छँटाई कॉलम",
"form.prefs.label.default_home_page": "डिफ़ॉल्ट होमपेज़",
"form.prefs.label.categories_sort_order": "श्रेणियाँ छँटाई",
"form.prefs.label.categories_sorting_order": "श्रेणियाँ छँटाई",
"form.import.label.file": "ओपीएमएल फ़ाइल",
"form.import.label.url": "यूआरएल",
"form.integration.fever_activate": "फीवर एपीआई सक्रिय करें",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "CSS personalizzati",
"form.prefs.label.entry_order": "Colonna di ordinamento delle voci",
"form.prefs.label.default_home_page": "Pagina iniziale predefinita",
"form.prefs.label.categories_sort_order": "Ordinamento delle categorie",
"form.prefs.label.categories_sorting_order": "Ordinamento delle categorie",
"form.import.label.file": "File OPML",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Abilita l'API di Fever",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "カスタムCSS",
"form.prefs.label.entry_order": "エントリーソートカラム",
"form.prefs.label.default_home_page": "デフォルトのトップページ",
"form.prefs.label.categories_sort_order": "カテゴリの並べ替え",
"form.prefs.label.categories_sorting_order": "カテゴリの並べ替え",
"form.import.label.file": "OPML ファイル",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Fever API を有効にする",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "Aangepaste CSS",
"form.prefs.label.entry_order": "Ingang Sorteerkolom",
"form.prefs.label.default_home_page": "Standaard startpagina",
"form.prefs.label.categories_sort_order": "Categorieën sorteren",
"form.prefs.label.categories_sorting_order": "Categorieën sorteren",
"form.import.label.file": "OPML-bestand",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Activeer Fever API",

View file

@ -315,7 +315,7 @@
"form.prefs.label.custom_css": "Niestandardowy CSS",
"form.prefs.label.entry_order": "Kolumna sortowania wpisów",
"form.prefs.label.default_home_page": "Domyślna strona główna",
"form.prefs.label.categories_sort_order": "Sortowanie kategorii",
"form.prefs.label.categories_sorting_order": "Sortowanie kategorii",
"form.import.label.file": "Plik OPML",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Aktywuj Fever API",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "CSS customizado",
"form.prefs.label.entry_order": "Coluna de Ordenação de Entrada",
"form.prefs.label.default_home_page": "Página inicial predefinida",
"form.prefs.label.categories_sort_order": "Classificação das categorias",
"form.prefs.label.categories_sorting_order": "Classificação das categorias",
"form.import.label.file": "Arquivo OPML",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Ativar API do Fever",

View file

@ -315,7 +315,7 @@
"form.prefs.label.custom_css": "Пользовательские CSS",
"form.prefs.label.entry_order": "Колонка сортировки ввода",
"form.prefs.label.default_home_page": "Домашняя страница по умолчанию",
"form.prefs.label.categories_sort_order": "Сортировка категорий",
"form.prefs.label.categories_sorting_order": "Сортировка категорий",
"form.import.label.file": "OPML файл",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Активировать Fever API",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "Özel CSS",
"form.prefs.label.entry_order": "Giriş Sıralama Sütunu",
"form.prefs.label.default_home_page": "Varsayılan ana sayfa",
"form.prefs.label.categories_sort_order": "Kategoriler sıralama",
"form.prefs.label.categories_sorting_order": "Kategoriler sıralama",
"form.import.label.file": "OPML dosyası",
"form.import.label.url": "URL",
"form.integration.fever_activate": "Fever API'yi Etkinleştir",

View file

@ -312,7 +312,7 @@
"form.prefs.label.custom_css": "Спеціальний CSS",
"form.prefs.label.entry_order": "Стовпець сортування записів",
"form.prefs.label.default_home_page": "Домашня сторінка за умовчанням",
"form.prefs.label.categories_sort_order": "Сортування за категоріями",
"form.prefs.label.categories_sorting_order": "Сортування за категоріями",
"form.import.label.file": "Файл OPML",
"form.import.label.url": "URL-адреса",
"form.integration.fever_activate": "Увімкнути API Fever",

View file

@ -311,7 +311,7 @@
"form.prefs.label.custom_css": "自定义 CSS",
"form.prefs.label.entry_order": "文章排序依据",
"form.prefs.label.default_home_page": "默认主页",
"form.prefs.label.categories_sort_order": "分类排序",
"form.prefs.label.categories_sorting_order": "分类排序",
"form.import.label.file": "OPML 文件",
"form.import.label.url": "URL",
"form.integration.fever_activate": "启用 Fever API",

View file

@ -313,7 +313,7 @@
"form.prefs.label.custom_css": "自定義 CSS",
"form.prefs.label.entry_order": "文章排序依據",
"form.prefs.label.default_home_page": "默認主頁",
"form.prefs.label.categories_sort_order": "分類排序",
"form.prefs.label.categories_sorting_order": "分類排序",
"form.import.label.file": "OPML 檔案",
"form.import.label.url": "URL",
"form.integration.fever_activate": "啟用 Fever API",

View file

@ -1,11 +1,10 @@
// Copyright 2017 Frédéric Guillot. All rights reserved.
// Copyright 2022 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package model // import "miniflux.app/model"
// HomePages returns the list of available home pages.
func CategoriesSortOptions() map[string]string {
func CategoriesSortingOptions() map[string]string {
return map[string]string{
"unread_count": "form.prefs.select.unread_count",
"alphabetical": "form.prefs.select.alphabetical",

View file

@ -12,28 +12,28 @@ import (
// User represents a user in the system.
type User struct {
ID int64 `json:"id"`
Username string `json:"username"`
Password string `json:"-"`
IsAdmin bool `json:"is_admin"`
Theme string `json:"theme"`
Language string `json:"language"`
Timezone string `json:"timezone"`
EntryDirection string `json:"entry_sorting_direction"`
EntryOrder string `json:"entry_sorting_order"`
Stylesheet string `json:"stylesheet"`
GoogleID string `json:"google_id"`
OpenIDConnectID string `json:"openid_connect_id"`
EntriesPerPage int `json:"entries_per_page"`
KeyboardShortcuts bool `json:"keyboard_shortcuts"`
ShowReadingTime bool `json:"show_reading_time"`
EntrySwipe bool `json:"entry_swipe"`
LastLoginAt *time.Time `json:"last_login_at"`
DisplayMode string `json:"display_mode"`
DefaultReadingSpeed int `json:"default_reading_speed"`
CJKReadingSpeed int `json:"cjk_reading_speed"`
DefaultHomePage string `json:"default_home_page"`
CategoriesSortOrder string `json:"categories_sort_order"`
ID int64 `json:"id"`
Username string `json:"username"`
Password string `json:"-"`
IsAdmin bool `json:"is_admin"`
Theme string `json:"theme"`
Language string `json:"language"`
Timezone string `json:"timezone"`
EntryDirection string `json:"entry_sorting_direction"`
EntryOrder string `json:"entry_sorting_order"`
Stylesheet string `json:"stylesheet"`
GoogleID string `json:"google_id"`
OpenIDConnectID string `json:"openid_connect_id"`
EntriesPerPage int `json:"entries_per_page"`
KeyboardShortcuts bool `json:"keyboard_shortcuts"`
ShowReadingTime bool `json:"show_reading_time"`
EntrySwipe bool `json:"entry_swipe"`
LastLoginAt *time.Time `json:"last_login_at"`
DisplayMode string `json:"display_mode"`
DefaultReadingSpeed int `json:"default_reading_speed"`
CJKReadingSpeed int `json:"cjk_reading_speed"`
DefaultHomePage string `json:"default_home_page"`
CategoriesSortingOrder string `json:"categories_sorting_order"`
}
// UserCreationRequest represents the request to create a user.
@ -47,26 +47,26 @@ type UserCreationRequest struct {
// UserModificationRequest represents the request to update a user.
type UserModificationRequest struct {
Username *string `json:"username"`
Password *string `json:"password"`
Theme *string `json:"theme"`
Language *string `json:"language"`
Timezone *string `json:"timezone"`
EntryDirection *string `json:"entry_sorting_direction"`
EntryOrder *string `json:"entry_sorting_order"`
Stylesheet *string `json:"stylesheet"`
GoogleID *string `json:"google_id"`
OpenIDConnectID *string `json:"openid_connect_id"`
EntriesPerPage *int `json:"entries_per_page"`
IsAdmin *bool `json:"is_admin"`
KeyboardShortcuts *bool `json:"keyboard_shortcuts"`
ShowReadingTime *bool `json:"show_reading_time"`
EntrySwipe *bool `json:"entry_swipe"`
DisplayMode *string `json:"display_mode"`
DefaultReadingSpeed *int `json:"default_reading_speed"`
CJKReadingSpeed *int `json:"cjk_reading_speed"`
DefaultHomePage *string `json:"default_home_page"`
CategoriesSortOrder *string `json:"categories_sort_order"`
Username *string `json:"username"`
Password *string `json:"password"`
Theme *string `json:"theme"`
Language *string `json:"language"`
Timezone *string `json:"timezone"`
EntryDirection *string `json:"entry_sorting_direction"`
EntryOrder *string `json:"entry_sorting_order"`
Stylesheet *string `json:"stylesheet"`
GoogleID *string `json:"google_id"`
OpenIDConnectID *string `json:"openid_connect_id"`
EntriesPerPage *int `json:"entries_per_page"`
IsAdmin *bool `json:"is_admin"`
KeyboardShortcuts *bool `json:"keyboard_shortcuts"`
ShowReadingTime *bool `json:"show_reading_time"`
EntrySwipe *bool `json:"entry_swipe"`
DisplayMode *string `json:"display_mode"`
DefaultReadingSpeed *int `json:"default_reading_speed"`
CJKReadingSpeed *int `json:"cjk_reading_speed"`
DefaultHomePage *string `json:"default_home_page"`
CategoriesSortingOrder *string `json:"categories_sorting_order"`
}
// Patch updates the User object with the modification request.
@ -147,8 +147,8 @@ func (u *UserModificationRequest) Patch(user *User) {
user.DefaultHomePage = *u.DefaultHomePage
}
if u.CategoriesSortOrder != nil {
user.CategoriesSortOrder = *u.CategoriesSortOrder
if u.CategoriesSortingOrder != nil {
user.CategoriesSortingOrder = *u.CategoriesSortingOrder
}
}

View file

@ -133,7 +133,7 @@ func (s *Storage) CategoriesWithFeedCount(userID int64) (model.Categories, error
user_id=$1
`
if user.CategoriesSortOrder == "alphabetical" {
if user.CategoriesSortingOrder == "alphabetical" {
query = query + `
ORDER BY
c.title ASC

View file

@ -89,7 +89,7 @@ func (s *Storage) CreateUser(userCreationRequest *model.UserCreationRequest) (*m
default_reading_speed,
cjk_reading_speed,
default_home_page,
categories_sort_order
categories_sorting_order
`
tx, err := s.db.Begin()
@ -125,7 +125,7 @@ func (s *Storage) CreateUser(userCreationRequest *model.UserCreationRequest) (*m
&user.DefaultReadingSpeed,
&user.CJKReadingSpeed,
&user.DefaultHomePage,
&user.CategoriesSortOrder,
&user.CategoriesSortingOrder,
)
if err != nil {
tx.Rollback()
@ -180,7 +180,7 @@ func (s *Storage) UpdateUser(user *model.User) error {
default_reading_speed=$17,
cjk_reading_speed=$18,
default_home_page=$19,
categories_sort_order=$20
categories_sorting_order=$20
WHERE
id=$21
`
@ -206,7 +206,7 @@ func (s *Storage) UpdateUser(user *model.User) error {
user.DefaultReadingSpeed,
user.CJKReadingSpeed,
user.DefaultHomePage,
user.CategoriesSortOrder,
user.CategoriesSortingOrder,
user.ID,
)
if err != nil {
@ -233,7 +233,7 @@ func (s *Storage) UpdateUser(user *model.User) error {
default_reading_speed=$16,
cjk_reading_speed=$17,
default_home_page=$18,
categories_sort_order=$19
categories_sorting_order=$19
WHERE
id=$20
`
@ -258,7 +258,7 @@ func (s *Storage) UpdateUser(user *model.User) error {
user.DefaultReadingSpeed,
user.CJKReadingSpeed,
user.DefaultHomePage,
user.CategoriesSortOrder,
user.CategoriesSortingOrder,
user.ID,
)
@ -304,7 +304,7 @@ func (s *Storage) UserByID(userID int64) (*model.User, error) {
default_reading_speed,
cjk_reading_speed,
default_home_page,
categories_sort_order
categories_sorting_order
FROM
users
WHERE
@ -337,7 +337,7 @@ func (s *Storage) UserByUsername(username string) (*model.User, error) {
default_reading_speed,
cjk_reading_speed,
default_home_page,
categories_sort_order
categories_sorting_order
FROM
users
WHERE
@ -370,7 +370,7 @@ func (s *Storage) UserByField(field, value string) (*model.User, error) {
default_reading_speed,
cjk_reading_speed,
default_home_page,
categories_sort_order
categories_sorting_order
FROM
users
WHERE
@ -410,7 +410,7 @@ func (s *Storage) UserByAPIKey(token string) (*model.User, error) {
u.default_reading_speed,
u.cjk_reading_speed,
u.default_home_page,
u.categories_sort_order
u.categories_sorting_order
FROM
users u
LEFT JOIN
@ -444,7 +444,7 @@ func (s *Storage) fetchUser(query string, args ...interface{}) (*model.User, err
&user.DefaultReadingSpeed,
&user.CJKReadingSpeed,
&user.DefaultHomePage,
&user.CategoriesSortOrder,
&user.CategoriesSortingOrder,
)
if err == sql.ErrNoRows {
@ -540,7 +540,7 @@ func (s *Storage) Users() (model.Users, error) {
default_reading_speed,
cjk_reading_speed,
default_home_page,
categories_sort_order
categories_sorting_order
FROM
users
ORDER BY username ASC
@ -575,7 +575,7 @@ func (s *Storage) Users() (model.Users, error) {
&user.DefaultReadingSpeed,
&user.CJKReadingSpeed,
&user.DefaultHomePage,
&user.CategoriesSortOrder,
&user.CategoriesSortingOrder,
)
if err != nil {

View file

@ -70,10 +70,10 @@
{{ end }}
</select>
<label for="form-categories-sort-order">{{ t "form.prefs.label.categories_sort_order" }}</label>
<select id="form-categories-sort-order" name="categories_sort_order">
{{ range $key, $value := .categories_sort_options }}
<option value="{{ $key }}" {{ if eq $key $.form.CategoriesSortOrder }}selected="selected"{{ end }}>{{ t $value }}</option>
<label for="form-categories-sorting-order">{{ t "form.prefs.label.categories_sorting_order" }}</label>
<select id="form-categories-sorting-order" name="categories_sorting_order">
{{ range $key, $value := .categories_sorting_options }}
<option value="{{ $key }}" {{ if eq $key $.form.CategoriesSortingOrder }}selected="selected"{{ end }}>{{ t $value }}</option>
{{ end }}
</select>

View file

@ -14,24 +14,24 @@ import (
// SettingsForm represents the settings form.
type SettingsForm struct {
Username string
Password string
Confirmation string
Theme string
Language string
Timezone string
EntryDirection string
EntryOrder string
EntriesPerPage int
KeyboardShortcuts bool
ShowReadingTime bool
CustomCSS string
EntrySwipe bool
DisplayMode string
DefaultReadingSpeed int
CJKReadingSpeed int
DefaultHomePage string
CategoriesSortOrder string
Username string
Password string
Confirmation string
Theme string
Language string
Timezone string
EntryDirection string
EntryOrder string
EntriesPerPage int
KeyboardShortcuts bool
ShowReadingTime bool
CustomCSS string
EntrySwipe bool
DisplayMode string
DefaultReadingSpeed int
CJKReadingSpeed int
DefaultHomePage string
CategoriesSortingOrder string
}
// Merge updates the fields of the given user.
@ -51,7 +51,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
user.CJKReadingSpeed = s.CJKReadingSpeed
user.DefaultReadingSpeed = s.DefaultReadingSpeed
user.DefaultHomePage = s.DefaultHomePage
user.CategoriesSortOrder = s.CategoriesSortOrder
user.CategoriesSortingOrder = s.CategoriesSortingOrder
if s.Password != "" {
user.Password = s.Password
@ -99,23 +99,23 @@ func NewSettingsForm(r *http.Request) *SettingsForm {
cjkReadingSpeed = 0
}
return &SettingsForm{
Username: r.FormValue("username"),
Password: r.FormValue("password"),
Confirmation: r.FormValue("confirmation"),
Theme: r.FormValue("theme"),
Language: r.FormValue("language"),
Timezone: r.FormValue("timezone"),
EntryDirection: r.FormValue("entry_direction"),
EntryOrder: r.FormValue("entry_order"),
EntriesPerPage: int(entriesPerPage),
KeyboardShortcuts: r.FormValue("keyboard_shortcuts") == "1",
ShowReadingTime: r.FormValue("show_reading_time") == "1",
CustomCSS: r.FormValue("custom_css"),
EntrySwipe: r.FormValue("entry_swipe") == "1",
DisplayMode: r.FormValue("display_mode"),
DefaultReadingSpeed: int(defaultReadingSpeed),
CJKReadingSpeed: int(cjkReadingSpeed),
DefaultHomePage: r.FormValue("default_home_page"),
CategoriesSortOrder: r.FormValue("categories_sort_order"),
Username: r.FormValue("username"),
Password: r.FormValue("password"),
Confirmation: r.FormValue("confirmation"),
Theme: r.FormValue("theme"),
Language: r.FormValue("language"),
Timezone: r.FormValue("timezone"),
EntryDirection: r.FormValue("entry_direction"),
EntryOrder: r.FormValue("entry_order"),
EntriesPerPage: int(entriesPerPage),
KeyboardShortcuts: r.FormValue("keyboard_shortcuts") == "1",
ShowReadingTime: r.FormValue("show_reading_time") == "1",
CustomCSS: r.FormValue("custom_css"),
EntrySwipe: r.FormValue("entry_swipe") == "1",
DisplayMode: r.FormValue("display_mode"),
DefaultReadingSpeed: int(defaultReadingSpeed),
CJKReadingSpeed: int(cjkReadingSpeed),
DefaultHomePage: r.FormValue("default_home_page"),
CategoriesSortingOrder: r.FormValue("categories_sorting_order"),
}
}

View file

@ -27,22 +27,22 @@ func (h *handler) showSettingsPage(w http.ResponseWriter, r *http.Request) {
}
settingsForm := form.SettingsForm{
Username: user.Username,
Theme: user.Theme,
Language: user.Language,
Timezone: user.Timezone,
EntryDirection: user.EntryDirection,
EntryOrder: user.EntryOrder,
EntriesPerPage: user.EntriesPerPage,
KeyboardShortcuts: user.KeyboardShortcuts,
ShowReadingTime: user.ShowReadingTime,
CustomCSS: user.Stylesheet,
EntrySwipe: user.EntrySwipe,
DisplayMode: user.DisplayMode,
DefaultReadingSpeed: user.DefaultReadingSpeed,
CJKReadingSpeed: user.CJKReadingSpeed,
DefaultHomePage: user.DefaultHomePage,
CategoriesSortOrder: user.CategoriesSortOrder,
Username: user.Username,
Theme: user.Theme,
Language: user.Language,
Timezone: user.Timezone,
EntryDirection: user.EntryDirection,
EntryOrder: user.EntryOrder,
EntriesPerPage: user.EntriesPerPage,
KeyboardShortcuts: user.KeyboardShortcuts,
ShowReadingTime: user.ShowReadingTime,
CustomCSS: user.Stylesheet,
EntrySwipe: user.EntrySwipe,
DisplayMode: user.DisplayMode,
DefaultReadingSpeed: user.DefaultReadingSpeed,
CJKReadingSpeed: user.CJKReadingSpeed,
DefaultHomePage: user.DefaultHomePage,
CategoriesSortingOrder: user.CategoriesSortingOrder,
}
timezones, err := h.store.Timezones()
@ -60,7 +60,7 @@ func (h *handler) showSettingsPage(w http.ResponseWriter, r *http.Request) {
view.Set("countUnread", h.store.CountUnreadEntries(user.ID))
view.Set("countErrorFeeds", h.store.CountUserFeedsWithErrors(user.ID))
view.Set("default_home_pages", model.HomePages())
view.Set("categories_sort_options", model.CategoriesSortOptions())
view.Set("categories_sorting_options", model.CategoriesSortingOptions())
html.OK(w, r, view.Render("settings"))
}