1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

Make entries sorting configurable

This commit is contained in:
Frédéric Guillot 2017-12-02 17:04:01 -08:00
parent 453ff64f29
commit 2f1367a8d4
28 changed files with 253 additions and 193 deletions

View file

@ -13,12 +13,13 @@ import (
// SettingsForm represents the settings form.
type SettingsForm struct {
Username string
Password string
Confirmation string
Theme string
Language string
Timezone string
Username string
Password string
Confirmation string
Theme string
Language string
Timezone string
EntryDirection string
}
// Merge updates the fields of the given user.
@ -27,6 +28,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
user.Theme = s.Theme
user.Language = s.Language
user.Timezone = s.Timezone
user.EntryDirection = s.EntryDirection
if s.Password != "" {
user.Password = s.Password
@ -37,7 +39,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
// Validate makes sure the form values are valid.
func (s *SettingsForm) Validate() error {
if s.Username == "" || s.Theme == "" || s.Language == "" || s.Timezone == "" {
if s.Username == "" || s.Theme == "" || s.Language == "" || s.Timezone == "" || s.EntryDirection == "" {
return errors.NewLocalizedError("The username, theme, language and timezone fields are mandatory.")
}
@ -57,11 +59,12 @@ func (s *SettingsForm) Validate() error {
// NewSettingsForm returns a new SettingsForm.
func NewSettingsForm(r *http.Request) *SettingsForm {
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"),
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"),
}
}