diff --git a/app/assets/javascripts/admin/views/site_setting_view.js b/app/assets/javascripts/admin/views/site_setting_view.js index 37b724a65..f7e955442 100644 --- a/app/assets/javascripts/admin/views/site_setting_view.js +++ b/app/assets/javascripts/admin/views/site_setting_view.js @@ -24,19 +24,20 @@ Discourse.SiteSettingView = Discourse.View.extend(Discourse.ScrollTop, { }.property('content.type'), - didInsertElement: function() { + _watchEnterKey: 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(); - } + this.$().on("keydown.site-setting-enter", ".input-setting-string", function (e) { + if (e.keyCode === 13) { // enter key + var setting = self.get('content'); + if (setting.get('dirty')) { + setting.save(); } - }); + } }); - } + }.on('didInsertElement'), + + _removeBindings: function() { + this.$().off("keydown.site-setting-enter"); + }.on("willDestroyElement") });