From 4295a86e55e765e3e396a03c090bd08be9e0a390 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 28 Apr 2019 18:20:46 -0700 Subject: Add option to enable/disable keyboard shortcuts --- ui/form/settings.go | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'ui/form') 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", } } -- cgit v1.2.3