]> git.openstreetmap.org Git - rails.git/commitdiff
Remove inline javascript from user settings page
authorTom Hughes <tom@compton.nu>
Fri, 24 Nov 2017 16:20:50 +0000 (16:20 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 24 Nov 2017 16:20:50 +0000 (16:20 +0000)
app/assets/javascripts/user.js
app/views/user/account.html.erb

index 1c73d3430456e6016cb48c528a0d89ab1d870366..bdf0443056329df566e07fbc880dd8ea3153b79c 100644 (file)
@@ -85,6 +85,10 @@ $(document).ready(function () {
 
   $("select#user_auth_provider").on("change", updateAuthUID);
 
+  $("input#user_image").on("change", function () {
+    $("#image_action_new").prop("checked", true);
+  });
+
   function enableAuth() {
     $("#auth_prompt").hide();
     $("#auth_field").show();
index 92b3407bfa6f4732d747cd6063c3656f491f41b0..169e5662aaedd4448b9c905072ea040fd14fca11 100644 (file)
                 <%= t 'user.account.replace image' %>
                 <span class="form-help deemphasize"><%= t 'user.account.image size hint' %></span>
             </label>
-            <%= f.file_field :image, :onchange => "$('#image_action_new').prop('checked', true)" %>
+            <%= f.file_field :image %>
           </li>
         <% else %>
         <li>
             <%= t 'user.account.new image' %>
             <span class="form-help deemphasize"><%= t 'user.account.image size hint' %></span>
           </label>
-          <%= f.file_field :image, :onchange => "$('#image_action_new').prop('checked', true)" %>
+          <%= f.file_field :image %>
         </li>
         <% end %>
         <li>