FEATURE: enter key in site setting input saves it

This commit is contained in:
Neil Lalonde 2014-07-11 14:44:30 -04:00
parent a9788bc4fe
commit d13dbaaa36
1 changed files with 16 additions and 1 deletions

View File

@ -22,6 +22,21 @@ Discourse.SiteSettingView = Discourse.View.extend(Discourse.ScrollTop, {
// Default to string editor // Default to string editor
return 'admin/templates/site_settings/setting_string'; 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();
}
}
});
});
}
}); });