Skip to content

Commit

Permalink
Make spamaway ids unique (publiclab#5465)
Browse files Browse the repository at this point in the history
  • Loading branch information
CleverFool77 authored and digitaldina committed May 12, 2019
1 parent dd6fd29 commit cacf380
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/views/layouts/_signupLoginModal.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="clearfix"> <!-- clearfix class allows the modal to expand to fit the content of this div -->
<div id="signupContainer">
<!-- signup partial -->
<%= render partial: "users/create_form" %>
<%= render partial: "users/create_form" , locals: {caller: "modal"} %>
</div>

<div id="loginContainer">
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/_create_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<% else %>

<div class="col-sm-12">
<%= render partial: 'users/spamaway' %>
<%= render partial: 'users/spamaway', locals: {caller: caller } %>
</div>

<script>
Expand Down
7 changes: 4 additions & 3 deletions app/views/users/_spamaway.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<div class="btn-group btn-group-justified" role="group">
<% [0,1].each_with_index do |s, j| %><% statement = turingtest[i][s] %>
<div class="btn-group" role="group">
<button type="button" class="col-xs-5 btn btn-default" style="font-size:3em;text-align:left;<% if i.odd? %> background:#eef;<% end %>" id="spamaway-<%= i.to_s + j.to_s %>">
<%= spam.radio_button vars[i], statement %> <%= statement %>
<button type="button" class="col-xs-5 btn btn-default" style="font-size:3em;text-align:left;<% if i.odd? %> background:#eef;<% end %>" id="spamaway-<%= caller %>-<%= i.to_s + j.to_s %>">
<%= spam.radio_button vars[i], statement, { id: "spamaway_statement_#{caller}_#{i.to_s}#{j.to_s}" } %> <%= statement %>
</button>
</div>
<% end %>
Expand All @@ -33,7 +33,8 @@
<%= spam.text_area :follow_instructions, { class: "form-control col-md-6",
rows: 8,
tabindex: 7,
placeholder: I18n.t('users._form.dont_write_here') }
placeholder: I18n.t('users._form.dont_write_here'),
id: 'spamaway-'+caller }
%>

</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/users/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<br />

<%= render 'create_form' %>
<%= render partial: 'users/create_form', locals: {caller: "signup"} %>

<br style="margin-bottom:20px;" />

Expand Down

0 comments on commit cacf380

Please sign in to comment.