- <%= form_for @user, as: :voter, url: officing_voters_path, method: :post, remote: true do |f| %>
+
+
+ <%= t("officing.voters.show.can_vote") %>
+
+ |
+
+ <%= form_for @user, as: :voter, url: officing_voters_path,
+ method: :post, remote: true,
+ html: { id: "new_officing_voter" } do |f| %>
<%= f.hidden_field :poll_id, value: poll.id %>
<%= f.hidden_field :user_id, value: @user.id %>
- <%= f.submit t("officing.voters.show.submit"), class: "button success expanded" %>
- <% end %>
-
-
+ <%= f.submit t("officing.voters.show.submit"),
+ class: "button success",
+ data: { disable_with: t("officing.voters.can_vote.submit_disable_with") } %>
+ <% end %>
+ |
diff --git a/app/views/officing/voters/_voted.html.erb b/app/views/officing/voters/_voted.html.erb
index edd098403..49d1523a6 100644
--- a/app/views/officing/voters/_voted.html.erb
+++ b/app/views/officing/voters/_voted.html.erb
@@ -1,7 +1,3 @@
-
-
-
- <%= t("officing.voters.show.success") %>
-
-
-
+
+ <%= t("officing.voters.show.success") %>
+
diff --git a/app/views/officing/voters/create.js.erb b/app/views/officing/voters/create.js.erb
index ee280faa2..3837f017e 100644
--- a/app/views/officing/voters/create.js.erb
+++ b/app/views/officing/voters/create.js.erb
@@ -1 +1,2 @@
-$("#<%= dom_id(@poll) %> #actions").html('<%= j render("voted") %>');
\ No newline at end of file
+$("#<%= dom_id(@poll) %> #actions").html('<%= j render("voted") %>');
+$("#<%= dom_id(@poll) %> #can_vote_callout").hide();
\ No newline at end of file
diff --git a/app/views/officing/voters/new.html.erb b/app/views/officing/voters/new.html.erb
index 0f8fa2958..a6ab32d33 100644
--- a/app/views/officing/voters/new.html.erb
+++ b/app/views/officing/voters/new.html.erb
@@ -7,7 +7,8 @@
| <%= t("officing.voters.new.table_poll") %> |
- <%= t("officing.voters.new.table_actions") %> |
+ <%= t("officing.voters.new.table_status") %> |
+ <%= t("officing.voters.new.table_actions") %> |
@@ -16,15 +17,13 @@
<%= poll.name %>
|
-
- <% if poll.votable_by?(@user) %>
- <%= render "can_vote", poll: poll %>
- <% else %>
- <%= render "already_voted" %>
- <% end %>
- |
+ <% if poll.votable_by?(@user) %>
+ <%= render "can_vote", poll: poll %>
+ <% else %>
+ <%= render "already_voted" %>
+ <% end %>
<% end %>
-<% end %>
\ No newline at end of file
+<% end %>
diff --git a/config/locales/en/officing.yml b/config/locales/en/officing.yml
index 378b87b15..bb9ef6bd2 100644
--- a/config/locales/en/officing.yml
+++ b/config/locales/en/officing.yml
@@ -58,9 +58,13 @@ en:
new:
title: Polls
table_poll: Poll
- table_actions: Polls status
+ table_status: Polls status
+ table_actions: Actions
show:
can_vote: Can vote
error_already_voted: Has already participated in this poll
+ no_actions: There is no available actions
submit: Confirm vote
success: "Vote introduced!"
+ can_vote:
+ submit_disable_with: "Wait, confirming vote..."
diff --git a/config/locales/es/officing.yml b/config/locales/es/officing.yml
index 354b59710..86d6982fc 100644
--- a/config/locales/es/officing.yml
+++ b/config/locales/es/officing.yml
@@ -58,9 +58,13 @@ es:
new:
title: Votaciones
table_poll: Votación
- table_actions: Estado de las votaciones
+ table_status: Estado de las votaciones
+ table_actions: Acciones
show:
can_vote: Puede votar
- error_already_voted: "Ya ha participado en esta votación."
+ error_already_voted: "Ya ha participado en esta votación"
+ no_actions: No hay acciones disponibles
submit: Confirmar voto
success: "¡Voto introducido!"
+ can_vote:
+ submit_disable_with: "Espera, confirmando voto..."
\ No newline at end of file
diff --git a/spec/features/polls/voter_spec.rb b/spec/features/polls/voter_spec.rb
index 256807928..334696768 100644
--- a/spec/features/polls/voter_spec.rb
+++ b/spec/features/polls/voter_spec.rb
@@ -51,8 +51,12 @@ feature "Voter" do
expect(page).to have_content poll.name
- first(:button, "Confirm vote").click
- expect(page).to have_content "Vote introduced!"
+ within("#poll_#{poll.id}") do
+ click_button("Confirm vote")
+ expect(page).to_not have_button("Confirm vote")
+ expect(page).to have_button('Wait, confirming vote...', disabled: true)
+ expect(page).to have_content "Vote introduced!"
+ end
expect(Poll::Voter.count).to eq(1)
expect(Poll::Voter.first.origin).to eq("booth")