From 1be8d599e878c83305439a9b4d5273d72d9712d7 Mon Sep 17 00:00:00 2001 From: Simon Poole Date: Tue, 2 Apr 2019 13:52:56 +0200 Subject: [PATCH] Add checkbox for contributor terms and improve text --- app/assets/javascripts/user.js | 6 +++++- app/controllers/users_controller.rb | 2 +- app/views/users/terms.html.erb | 18 ++++++++++++------ config/locales/en.yml | 9 +++++---- test/controllers/users_controller_test.rb | 18 +++++++++--------- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/app/assets/javascripts/user.js b/app/assets/javascripts/user.js index 3803e180f..13941d6f3 100644 --- a/app/assets/javascripts/user.js +++ b/app/assets/javascripts/user.js @@ -125,7 +125,11 @@ $(document).ready(function () { $("#contributorTerms").load(url); }); + $("#read_ct").on("click", function () { + $("#continue").prop("disabled", !($(this).prop("checked") && $("#read_tou").prop("checked"))); + }); + $("#read_tou").on("click", function () { - $("#agree").prop("disabled", !$(this).prop("checked")); + $("#continue").prop("disabled", !($(this).prop("checked") && $("#read_ct").prop("checked"))); }); }); diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 4b56dc033..e41330c4b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -36,7 +36,7 @@ class UsersController < ApplicationController 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 diff --git a/app/views/users/terms.html.erb b/app/views/users/terms.html.erb index ee74312f7..4e45671e1 100644 --- a/app/views/users/terms.html.erb +++ b/app/views/users/terms.html.erb @@ -33,29 +33,35 @@ <%= render :partial => "terms" %> -
-

+

+

<%= raw t '.guidance', :summary => 'https://www.osmfoundation.org/wiki/License/Contributor_Terms_Summary', :translations => 'https://www.osmfoundation.org/wiki/License/Contributor_Terms/Informal_Translations' %>

+
+ +
-

<%= t '.tou_explain' %>

+

<%= t '.tou_explain_html', :tou_link => link_to(t('layouts.tou'), "https://wiki.osmfoundation.org/wiki/Terms_of_Use", :target => :new) %>

<%= hidden_field_tag("referer", h(params[:referer])) unless params[:referer].nil? %>
- <%= 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") %>