From ccd83f5004283a24260cca4e0c4d3a8a354d4325 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 19 Apr 2017 00:22:31 +0200 Subject: [PATCH] Re-enabled form of setting after submit. --- .../javascripts/app/controllers/_settings/area_item.coffee | 3 +-- app/assets/javascripts/app/models/setting.coffee | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_settings/area_item.coffee b/app/assets/javascripts/app/controllers/_settings/area_item.coffee index 94fd86a99..c7db71eb3 100644 --- a/app/assets/javascripts/app/controllers/_settings/area_item.coffee +++ b/app/assets/javascripts/app/controllers/_settings/area_item.coffee @@ -52,5 +52,4 @@ class App.SettingsAreaItem extends App.Controller value = params else value = directData - - App.Setting.set(@setting['name'], value) + App.Setting.set(@setting['name'], value, doneLocal: => @formEnable(e)) diff --git a/app/assets/javascripts/app/models/setting.coffee b/app/assets/javascripts/app/models/setting.coffee index 04bb58d12..a91ca9c5b 100644 --- a/app/assets/javascripts/app/models/setting.coffee +++ b/app/assets/javascripts/app/models/setting.coffee @@ -21,6 +21,8 @@ class App.Setting extends App.Model timeout: 2000 } App.Setting.preferencesPost(@) + if options.doneLocal + options.doneLocal(@) if !options.fail options.fail = (settings, details) -> @@ -29,6 +31,8 @@ class App.Setting extends App.Model msg: App.i18n.translateContent(details.error_human || details.error || 'Unable to update object!') timeout: 2000 } + if options.failLocal + options.failLocal(@) if setting.frontend App.Config.set(name, value) setting.save(options)