From 0e21436aaf9ea2ed988c3e515e0db73df70534c4 Mon Sep 17 00:00:00 2001 From: Robert Speicher Date: Fri, 5 Jun 2015 18:01:45 -0400 Subject: Simplify the javascript behavior for Preference updating --- app/assets/javascripts/profile.js.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'app/assets') diff --git a/app/assets/javascripts/profile.js.coffee b/app/assets/javascripts/profile.js.coffee index a402973a543..bb0b66b86e1 100644 --- a/app/assets/javascripts/profile.js.coffee +++ b/app/assets/javascripts/profile.js.coffee @@ -1,10 +1,8 @@ class @Profile constructor: -> - $('.edit_user .application-theme input, .edit_user .code-preview-theme input').click -> - # Submit the form - $('.edit_user').submit() - - new Flash('Preferences saved.', 'notice') + # Automatically submit the Preferences form when any of its radio buttons change + $('.js-preferences-form').on 'change.preference', 'input[type=radio]', -> + $(this).parents('form').submit() $('.update-username form').on 'ajax:before', -> $('.loading-gif').show() @@ -18,7 +16,6 @@ class @Profile $('.update-notifications').on 'ajax:complete', -> $(this).find('.btn-save').enable() - $('.js-choose-user-avatar-button').bind "click", -> form = $(this).closest("form") form.find(".js-user-avatar-input").click() -- cgit v1.2.1