From d13dbaaa364b380c47518f19d14c84713f7f2e1d Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Fri, 11 Jul 2014 14:44:30 -0400 Subject: [PATCH] FEATURE: enter key in site setting input saves it --- .../admin/views/site_setting_view.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/admin/views/site_setting_view.js b/app/assets/javascripts/admin/views/site_setting_view.js index b288d36c96d..37b724a65fb 100644 --- a/app/assets/javascripts/admin/views/site_setting_view.js +++ b/app/assets/javascripts/admin/views/site_setting_view.js @@ -22,6 +22,21 @@ Discourse.SiteSettingView = Discourse.View.extend(Discourse.ScrollTop, { // Default to string editor return 'admin/templates/site_settings/setting_string'; - }.property('content.type') + }.property('content.type'), + + didInsertElement: function() { + var self = this; + this._super(); + Em.run.schedule('afterRender', function() { + self.$('.input-setting-string').keydown(function(e) { + if (e.keyCode === 13) { // enter key + var setting = self.get('content'); + if (setting.get('dirty')) { + setting.save(); + } + } + }); + }); + } });