aboutsummaryrefslogtreecommitdiffhomepage
path: root/ui/form
diff options
context:
space:
mode:
authorGravatar Frédéric Guillot <fred@miniflux.net>2019-04-28 18:20:46 -0700
committerGravatar fguillot <fred@miniflux.net>2019-04-28 18:35:58 -0700
commit4295a86e55e765e3e396a03c090bd08be9e0a390 (patch)
tree77b388feb1ec345c3823b7c7338ab8d293ff3b77 /ui/form
parent3c8cc0b2b69c8de7343dfbec0e22934c954487df (diff)
Add option to enable/disable keyboard shortcuts
Diffstat (limited to 'ui/form')
-rw-r--r--ui/form/settings.go31
1 files changed, 17 insertions, 14 deletions
diff --git a/ui/form/settings.go b/ui/form/settings.go
index 0377f5f..8b4d7e6 100644
--- a/ui/form/settings.go
+++ b/ui/form/settings.go
@@ -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",
}
}