Move onclick handling of tou checkbox to ujs
authorSimon Poole <simon@poole.ch>
Fri, 26 Oct 2018 18:00:00 +0000 (20:00 +0200)
committerSimon Poole <simon@poole.ch>
Mon, 13 May 2019 14:52:18 +0000 (16:52 +0200)
app/assets/javascripts/user.js
app/views/users/terms.html.erb

index f898455b5815feab5fc2e0c76849687f80f829aa..40ca866c52d65ab7dca633b55a383780ea4186d8 100644 (file)
@@ -124,4 +124,9 @@ $(document).ready(function () {
     $("#contributorTerms").html("<img src='" + OSM.SEARCHING + "' />");
     $("#contributorTerms").load(url);
   });
     $("#contributorTerms").html("<img src='" + OSM.SEARCHING + "' />");
     $("#contributorTerms").load(url);
   });
+
+  $("#read_tou").on("click", function () { 
+    var agreebtn = document.getElementById('agree');
+    agreebtn.disabled=!this.checked;
+  });
 });
 });
index 18b86dd12582aa50c9415928dd9b0dfbf0ef2641..7a6acbf592a4af8bf2aea1e8127833b6199f4831 100644 (file)
@@ -47,7 +47,7 @@
   <p class="deemphasize"><%= t '.tou_explain' %></p>
   <div class="form-row">
     <label for="read_tou">
   <p class="deemphasize"><%= t '.tou_explain' %></p>
   <div class="form-row">
     <label for="read_tou">
-      <%= check_box_tag 'read_tou',1,false,:onclick=>"agreebtn = document.getElementById('agree');agreebtn.disabled=!this.checked;"%>
+      <%= check_box_tag 'read_tou',1,false %>
       <%= t '.read_tou_html', :tou_link => link_to(t('layouts.tou'), "https://wiki.osmfoundation.org/wiki/Terms_of_Use", :target => :new) %>
     </label>
 
       <%= t '.read_tou_html', :tou_link => link_to(t('layouts.tou'), "https://wiki.osmfoundation.org/wiki/Terms_of_Use", :target => :new) %>
     </label>