]> git.openstreetmap.org Git - rails.git/commitdiff
Add checkbox for contributor terms and improve text
authorSimon Poole <simon@poole.ch>
Tue, 2 Apr 2019 11:52:56 +0000 (13:52 +0200)
committerSimon Poole <simon@poole.ch>
Mon, 13 May 2019 14:54:29 +0000 (16:54 +0200)
app/assets/javascripts/user.js
app/controllers/users_controller.rb
app/views/users/terms.html.erb
config/locales/en.yml
test/controllers/users_controller_test.rb

index 3803e180f1dc4acfda664a9892a8b40e8007a58f..13941d6f3e0c3e192b4d0028c16d6adbca828934 100644 (file)
@@ -125,7 +125,11 @@ $(document).ready(function () {
     $("#contributorTerms").load(url);
   });
 
     $("#contributorTerms").load(url);
   });
 
+  $("#read_ct").on("click", function () { 
+    $("#continue").prop("disabled", !($(this).prop("checked") && $("#read_tou").prop("checked")));
+  });
+
   $("#read_tou").on("click", function () { 
   $("#read_tou").on("click", function () { 
-    $("#agree").prop("disabled", !$(this).prop("checked"));
+    $("#continue").prop("disabled", !($(this).prop("checked") && $("#read_ct").prop("checked")));
   });
 });
   });
 });
index 4b56dc03315bdbada9e7093d444ee569f01e2bec..e41330c4b40306e808423796c70bf6ef5053a93f 100644 (file)
@@ -36,7 +36,7 @@ class UsersController < ApplicationController
   def save
     @title = t "users.new.title"
 
   def save
     @title = t "users.new.title"
 
-    if params[:decline] || !params[:read_tou]
+    if params[:decline] || !(params[:read_tou] && params[:read_ct])
       if current_user
         current_user.terms_seen = true
 
       if current_user
         current_user.terms_seen = true
 
index ee74312f7532cf81085e06e7aad4c786affbef99..4e45671e1e7d6a79fc58e4276bf1778e21fb6762 100644 (file)
     <%= render :partial => "terms" %>
   </div>
 
     <%= render :partial => "terms" %>
   </div>
 
-  <div class="deemphasize">
-    <p id="contributorGuidance">
+  <div>
+    <p id="contributorGuidance" class="deemphasize">
       <%= raw t '.guidance',
                 :summary => 'https://www.osmfoundation.org/wiki/License/Contributor_Terms_Summary',
                 :translations => 'https://www.osmfoundation.org/wiki/License/Contributor_Terms/Informal_Translations' %>
     </p>
   </div>
       <%= raw t '.guidance',
                 :summary => 'https://www.osmfoundation.org/wiki/License/Contributor_Terms_Summary',
                 :translations => 'https://www.osmfoundation.org/wiki/License/Contributor_Terms/Informal_Translations' %>
     </p>
   </div>
+  <div class="form-row">
+    <label for="read_ct">
+      <%= check_box_tag 'read_ct' %>
+      <%= t '.read_ct' %>
+    </label>
+  </div>
 
   <label class="standard-label">
     <%= t 'layouts.tou' %>
   </label>
 
   <label class="standard-label">
     <%= t 'layouts.tou' %>
   </label>
-  <p class="deemphasize"><%= t '.tou_explain' %></p>
+  <p class="deemphasize"><%= t '.tou_explain_html', :tou_link => link_to(t('layouts.tou'), "https://wiki.osmfoundation.org/wiki/Terms_of_Use", :target => :new) %></p>
   <div class="form-row">
     <label for="read_tou">
       <%= check_box_tag 'read_tou' %>
   <div class="form-row">
     <label for="read_tou">
       <%= check_box_tag 'read_tou' %>
-      <%= t '.read_tou_html', :tou_link => link_to(t('layouts.tou'), "https://wiki.osmfoundation.org/wiki/Terms_of_Use", :target => :new) %>
+      <%= t '.read_tou' %>
     </label>
 
     <%= hidden_field_tag("referer", h(params[:referer])) unless params[:referer].nil? %>
 
     <div class="buttons form-row inner20 clearfix">
     </label>
 
     <%= hidden_field_tag("referer", h(params[:referer])) unless params[:referer].nil? %>
 
     <div class="buttons form-row inner20 clearfix">
-      <%= submit_tag(t('.agree'), :name => "agree", :id => "agree", :disabled => true)  %>
-      <%= submit_tag(t('.decline'), :name => "decline", :id => "decline") %>
+      <%= submit_tag("Continue", :name => "continue", :id => "continue", :disabled => true)  %>
+      <%= submit_tag("Cancel", :name => "decline", :id => "decline") %>
     </div>
 
     <label for="user_consider_pd">
     </div>
 
     <label for="user_consider_pd">
index 1d82e040feab93a0abef30504e1d9f5a0dce22a8..ad1f68df0d4397d7b028c3a59b5802d5f38d3126 100644 (file)
@@ -2030,15 +2030,16 @@ en:
       title: "Terms"
       heading: "Terms"
       heading_ct: "Contributor terms"
       title: "Terms"
       heading: "Terms"
       heading_ct: "Contributor terms"
-      read and accept with tou: "Please read the contributor agreement and the terms of use, check the checkbox when done and then press the agree button to confirm that you accept the terms of both documents." 
+      read and accept with tou: "Please read the contributor agreement and the terms of use, check both checkboxes when done and then press the continue button."
       contributor_terms_explain: "This agreement governs the terms for your existing and future contributions."
       contributor_terms_explain: "This agreement governs the terms for your existing and future contributions."
-      tou_explain: "These terms govern the use of the website and other infrastructure provided by the OSMF."
-      read_tou_html: "I have read and agree to the %{tou_link}"
+      read_ct: "I have read and agree to the above contributor terms"
+      tou_explain_html: "These %{tou_link} govern the use of the website and other infrastructure provided by the OSMF. Please click on the link, read and aggree to the text."
+      read_tou: "I have read and agree to the Terms of Use"
       consider_pd: "In addition to the above, I consider my contributions to be in the Public Domain"
       consider_pd_why: "what's this?"
       consider_pd_why_url: https://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
       guidance: 'Information to help understand these terms: a <a href="%{summary}">human readable summary</a> and some <a href="%{translations}">informal translations</a>'
       consider_pd: "In addition to the above, I consider my contributions to be in the Public Domain"
       consider_pd_why: "what's this?"
       consider_pd_why_url: https://www.osmfoundation.org/wiki/License/Why_would_I_want_my_contributions_to_be_public_domain
       guidance: 'Information to help understand these terms: a <a href="%{summary}">human readable summary</a> and some <a href="%{translations}">informal translations</a>'
-      agree: Agree
+      continue: Continue
       declined: "https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
       decline: "Decline"
       you need to accept or decline: "Please read and then either accept or decline the new Contributor Terms to continue."
       declined: "https://wiki.openstreetmap.org/wiki/Contributor_Terms_Declined"
       decline: "Decline"
       you need to accept or decline: "Please read and then either accept or decline the new Contributor Terms to continue."
index 0bc10885d365db3c99e8f92e9e66daff9de361ae..df2e7d8f52a5420e9dcd987ee5febb68763e90c1 100644 (file)
@@ -221,7 +221,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_difference "User.count", 1 do
       assert_difference "ActionMailer::Base.deliveries.size", 1 do
         perform_enqueued_jobs do
     assert_difference "User.count", 1 do
       assert_difference "ActionMailer::Base.deliveries.size", 1 do
         perform_enqueued_jobs do
-          post :save, :session => { :new_user => user }, :params => { :read_tou => 1 }
+          post :save, :session => { :new_user => user }, :params => { :read_ct => 1, :read_tou => 1 }
         end
       end
     end
         end
       end
     end
@@ -245,7 +245,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
-          post :save, :session => { :new_user => user }, :params => { :read_tou => 1 }
+          post :save, :session => { :new_user => user }, :params => { :read_ct => 1, :read_tou => 1 }
         end
       end
     end
         end
       end
     end
@@ -262,7 +262,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
-          post :save, :session => { :new_user => user }, :params => { :read_tou => 1 }
+          post :save, :session => { :new_user => user }, :params => { :read_ct => 1, :read_tou => 1 }
         end
       end
     end
         end
       end
     end
@@ -279,7 +279,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
-          post :save, :session => { :new_user => user }, :params => { :read_tou => 1 }
+          post :save, :session => { :new_user => user }, :params => { :read_ct => 1, :read_tou => 1 }
         end
       end
     end
         end
       end
     end
@@ -296,7 +296,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
-          post :save, :session => { :new_user => user }, :params => { :read_tou => 1 }
+          post :save, :session => { :new_user => user }, :params => { :read_ct => 1, :read_tou => 1 }
         end
       end
     end
         end
       end
     end
@@ -313,7 +313,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
     assert_no_difference "User.count" do
       assert_no_difference "ActionMailer::Base.deliveries.size" do
         perform_enqueued_jobs do
-          post :save, :session => { :new_user => user }, :params => { :read_tou => 1 }
+          post :save, :session => { :new_user => user }, :params => { :read_ct => 1, :read_tou => 1 }
         end
       end
     end
         end
       end
     end
@@ -330,7 +330,7 @@ class UsersControllerTest < ActionController::TestCase
         perform_enqueued_jobs do
           post :save, :session => { :new_user => user,
                                     :referer => "/edit?editor=id#map=1/2/3" },
         perform_enqueued_jobs do
           post :save, :session => { :new_user => user,
                                     :referer => "/edit?editor=id#map=1/2/3" },
-                      :params => { :read_tou => 1 }
+                      :params => { :read_ct => 1, :read_tou => 1 }
         end
       end
     end
         end
       end
     end
@@ -638,7 +638,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_response :success
     assert_template :terms
 
     assert_response :success
     assert_template :terms
 
-    post :save, :params => { :user => { :consider_pd => true }, :read_tou => 1 }
+    post :save, :params => { :user => { :consider_pd => true }, :read_ct => 1, :read_tou => 1 }
     assert_response :redirect
     assert_redirected_to :action => :account, :display_name => user.display_name
     assert_equal "Thanks for accepting the new contributor terms!", flash[:notice]
     assert_response :redirect
     assert_redirected_to :action => :account, :display_name => user.display_name
     assert_equal "Thanks for accepting the new contributor terms!", flash[:notice]
@@ -659,7 +659,7 @@ class UsersControllerTest < ActionController::TestCase
     assert_response :success
     assert_template :terms
 
     assert_response :success
     assert_template :terms
 
-    post :save, :params => { :user => { :consider_pd => true }, :referer => "/test", :read_tou => 1 }
+    post :save, :params => { :user => { :consider_pd => true }, :referer => "/test", :read_ct => 1, :read_tou => 1 }
     assert_response :redirect
     assert_redirected_to "/test"
     assert_equal "Thanks for accepting the new contributor terms!", flash[:notice]
     assert_response :redirect
     assert_redirected_to "/test"
     assert_equal "Thanks for accepting the new contributor terms!", flash[:notice]