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

Add option to enable/disable keyboard shortcuts

This commit is contained in:
Frédéric Guillot 2019-04-28 18:20:46 -07:00 committed by fguillot
parent 3c8cc0b2b6
commit 4295a86e55
24 changed files with 183 additions and 112 deletions

View file

@ -13,13 +13,14 @@ import (
// SettingsForm represents the settings form.
type SettingsForm struct {
Username string
Password string
Confirmation string
Theme string
Language string
Timezone string
EntryDirection string
Username string
Password string
Confirmation string
Theme string
Language string
Timezone string
EntryDirection string
KeyboardShortcuts bool
}
// Merge updates the fields of the given user.
@ -29,6 +30,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
user.Language = s.Language
user.Timezone = s.Timezone
user.EntryDirection = s.EntryDirection
user.KeyboardShortcuts = s.KeyboardShortcuts
if s.Password != "" {
user.Password = s.Password
@ -64,12 +66,13 @@ 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"),
EntryDirection: r.FormValue("entry_direction"),
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"),
KeyboardShortcuts: r.FormValue("keyboard_shortcuts") == "1",
}
}