Skip to content

Commit

Permalink
Merge pull request #33 from consuldev/accept-terms
Browse files Browse the repository at this point in the history
Check terms of service by default on new forms
  • Loading branch information
decabeza committed Jun 25, 2020
2 parents eb1471a + 504bb93 commit 1441603
Show file tree
Hide file tree
Showing 19 changed files with 122 additions and 83 deletions.
7 changes: 1 addition & 6 deletions app/views/budgets/investments/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,7 @@
<% unless current_user.manager? %>
<p class="form-label"><%= t("shared.required_fields") %></p>

<%= f.check_box :terms_of_service,
title: t("form.accept_terms_title"),
label: t("form.accept_terms",
policy: link_to(t("form.policy"), "/privacy", target: "blank"),
conditions: link_to(t("form.conditions"), "/conditions", target: "blank")
) %>
<%= f.hidden_field :terms_of_service, value: 1 %>
<% end %>
<%= f.submit(nil, class: "button large margin-top") %>
Expand Down
7 changes: 1 addition & 6 deletions app/views/debates/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,7 @@
<% if @debate.new_record? %>
<p class="form-label"><%= t("shared.required_fields") %></p>

<%= f.check_box :terms_of_service,
title: t("form.accept_terms_title"),
label: t("form.accept_terms",
policy: link_to(t("form.policy"), "/privacy", target: "blank"),
conditions: link_to(t("form.conditions"), "/conditions", target: "blank")
) %>
<%= f.hidden_field :terms_of_service, value: 1 %>
<% end %>
<%= f.submit(class: "button large margin-top", value: t("debates.#{action_name}.form.submit_button")) %>
Expand Down
7 changes: 1 addition & 6 deletions app/views/legislation/proposals/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@

<div class="small-12 column">
<% if @proposal.new_record? %>
<%= f.check_box :terms_of_service,
title: t("form.accept_terms_title"),
label: t("form.accept_terms",
policy: link_to(t("form.policy"), "/privacy", target: "blank"),
conditions: link_to(t("form.conditions"), "/conditions", target: "blank")
) %>
<%= f.hidden_field :terms_of_service, value: 1 %>
<% end %>
</div>

Expand Down
7 changes: 1 addition & 6 deletions app/views/proposals/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,7 @@
<% if @proposal.new_record? %>
<p class="form-label"><%= t("shared.required_fields") %></p>

<%= f.check_box :terms_of_service,
title: t("form.accept_terms_title"),
label: t("form.accept_terms",
policy: link_to(t("form.policy"), "/privacy", target: "blank"),
conditions: link_to(t("form.conditions"), "/conditions", target: "blank")
) %>
<%= f.hidden_field :terms_of_service, value: 1 %>
<% end %>
<%= f.submit(class: "button large margin-top",
Expand Down
18 changes: 12 additions & 6 deletions spec/features/budgets/investments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,8 @@ def investments_order
fill_in "Title", with: "I am a bot"
fill_in "budget_investment_subtitle", with: "This is the honeypot"
fill_in "Description", with: "This is the description"
check "I agree to the Privacy Policy and the Terms and conditions of use"
# Check terms of service by default
# check "I agree to the Privacy Policy and the Terms and conditions of use"

click_button "Create Investment"

Expand All @@ -862,7 +863,8 @@ def investments_order

fill_in "Title", with: "I am a bot"
fill_in "Description", with: "This is the description"
check "I agree to the Privacy Policy and the Terms and conditions of use"
# Check terms of service by default
# check "I agree to the Privacy Policy and the Terms and conditions of use"

click_button "Create Investment"

Expand All @@ -886,7 +888,8 @@ def investments_order
fill_in "If you are proposing in the name of a collective/organization, "\
"or on behalf of more people, write its name", with: "T.I.A."
fill_in "Tags", with: "Towers"
check "I agree to the Privacy Policy and the Terms and conditions of use"
# Check terms of service by default
# check "I agree to the Privacy Policy and the Terms and conditions of use"

click_button "Create Investment"

Expand Down Expand Up @@ -923,7 +926,8 @@ def investments_order
fill_in "budget_investment_location", with: "City center"
fill_in "budget_investment_organization_name", with: "T.I.A."
fill_in "budget_investment_tag_list", with: "Towers"
check "budget_investment_terms_of_service"
# Check terms of service by default
# check "budget_investment_terms_of_service"

click_button "Create Investment"

Expand All @@ -950,7 +954,8 @@ def investments_order

click_link("Edit", match: :first)
fill_in "Title", with: "Park improvements"
check "budget_investment_terms_of_service"
# Check terms of service by default
# check "budget_investment_terms_of_service"

click_button "Update Investment"

Expand All @@ -968,7 +973,8 @@ def investments_order
visit user_path(daniel, filter: "budget_investments")
click_link("Edit", match: :first)
fill_in "Title", with: ""
check "budget_investment_terms_of_service"
# Check terms of service by default
# check "budget_investment_terms_of_service"

click_button "Update Investment"

Expand Down
24 changes: 16 additions & 8 deletions spec/features/debates_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@
visit new_debate_path
fill_in "Debate title", with: "A title for a debate"
fill_in "Initial debate text", with: "This is very important because..."
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

click_button "Start a debate"

Expand All @@ -197,7 +198,8 @@
fill_in "Debate title", with: "I am a bot"
fill_in "debate_subtitle", with: "This is a honeypot field"
fill_in "Initial debate text", with: "This is the description"
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

click_button "Start a debate"

Expand All @@ -215,7 +217,8 @@
visit new_debate_path
fill_in "Debate title", with: "I am a bot"
fill_in "Initial debate text", with: "This is the description"
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

click_button "Start a debate"

Expand All @@ -240,7 +243,8 @@
visit new_debate_path
fill_in "Debate title", with: "Testing an attack"
fill_in "Initial debate text", with: "<p>This is <script>alert('an attack');</script></p>"
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

click_button "Start a debate"

Expand All @@ -258,7 +262,8 @@
visit new_debate_path
fill_in "Debate title", with: "Testing auto link"
fill_in "Initial debate text", with: "<p>This is a link www.example.org</p>"
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

click_button "Start a debate"

Expand All @@ -275,7 +280,8 @@
visit new_debate_path
fill_in "Debate title", with: "Testing auto link"
fill_in "Initial debate text", with: js_injection_string
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

click_button "Start a debate"

Expand Down Expand Up @@ -1078,7 +1084,8 @@
login_as(create(:user))
visit new_debate_path
fill_in "Debate title", with: "debate"
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

within("div.js-suggest") do
expect(page).to have_content "You are seeing 5 of 6 debates containing the term 'debate'"
Expand All @@ -1092,7 +1099,8 @@
login_as(create(:user))
visit new_debate_path
fill_in "Debate title", with: "proposal"
check "debate_terms_of_service"
# Check terms of service by default
# check "debate_terms_of_service"

within("div.js-suggest") do
expect(page).not_to have_content "You are seeing"
Expand Down
3 changes: 2 additions & 1 deletion spec/features/emails_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,8 @@

fill_in "Title", with: "Build a hospital"
fill_in "Description", with: "We have lots of people that require medical attention"
check "budget_investment_terms_of_service"
# Check terms of service by default
# check "budget_investment_terms_of_service"

click_button "Create Investment"
expect(page).to have_content "Investment created successfully"
Expand Down
3 changes: 2 additions & 1 deletion spec/features/legislation/proposals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ def legislation_proposals_order
fill_in "Proposal title", with: "Legislation proposal with image"
fill_in "Proposal summary", with: "Including an image on a legislation proposal"
imageable_attach_new_file(create(:image), Rails.root.join("spec/fixtures/files/clippy.jpg"))
check "legislation_proposal_terms_of_service"
# Check terms of service by default
# check "legislation_proposal_terms_of_service"
click_button "Create proposal"

expect(page).to have_content "Legislation proposal with image"
Expand Down
3 changes: 2 additions & 1 deletion spec/features/management/proposals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..."
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yRYFKcMa_Ek"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand Down
36 changes: 24 additions & 12 deletions spec/features/proposals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "proposal_tag_list", with: "Refugees, Solidarity"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand Down Expand Up @@ -299,7 +300,8 @@
fill_in "Proposal summary", with: "This is the summary"
fill_in "Proposal text", with: "This is the description"
fill_in "proposal_responsible_name", with: "Some other robot"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand All @@ -319,7 +321,8 @@
fill_in "Proposal summary", with: "This is the summary"
fill_in "Proposal text", with: "This is the description"
fill_in "proposal_responsible_name", with: "Some other robot"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand All @@ -338,7 +341,8 @@
fill_in "Proposal text", with: "This is very important because..."
fill_in "proposal_responsible_name", with: "Isabel Garcia"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand All @@ -359,7 +363,8 @@
fill_in "Proposal title", with: "Help refugees"
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "This is very important because..."
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
Expand Down Expand Up @@ -388,7 +393,8 @@
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "<p>This is <script>alert('an attack');</script></p>"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand All @@ -411,7 +417,8 @@
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: "<p>This is a link www.example.org</p>"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand All @@ -433,7 +440,8 @@
fill_in "Proposal summary", with: "In summary, what we want is..."
fill_in "Proposal text", with: js_injection_string
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand Down Expand Up @@ -490,7 +498,8 @@
fill_in "Proposal text", with: "This is very important because..."
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_responsible_name", with: "Isabel Garcia"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

select("California", from: "proposal_geozone_id")
click_button "Create proposal"
Expand Down Expand Up @@ -1708,7 +1717,8 @@
login_as(create(:user))
visit new_proposal_path
fill_in "Proposal title", with: "search"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

within("div.js-suggest") do
expect(page).to have_content "You are seeing 5 of 6 proposals containing the term 'search'"
Expand All @@ -1722,7 +1732,8 @@
login_as(create(:user))
visit new_proposal_path
fill_in "Proposal title", with: "debate"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

within("div.js-suggest") do
expect(page).not_to have_content "You are seeing"
Expand Down Expand Up @@ -1895,7 +1906,8 @@
fill_in "Proposal text", with: "This is very important because..."
fill_in "proposal_video_url", with: "https://www.youtube.com/watch?v=yPQfcG-eimk"
fill_in "proposal_tag_list", with: "Refugees, Solidarity"
check "proposal_terms_of_service"
# Check terms of service by default
# check "proposal_terms_of_service"

click_button "Create proposal"

Expand Down
Loading

0 comments on commit 1441603

Please sign in to comment.