diff --git a/app/views/officing/voters/_already_voted.html.erb b/app/views/officing/voters/_already_voted.html.erb new file mode 100644 index 000000000..1af002b3f --- /dev/null +++ b/app/views/officing/voters/_already_voted.html.erb @@ -0,0 +1,8 @@ + +

+ <%= t("officing.voters.show.error_already_voted") %> +

+ + + <%= t("officing.voters.show.no_actions") %> + diff --git a/app/views/officing/voters/_can_vote.html.erb b/app/views/officing/voters/_can_vote.html.erb new file mode 100644 index 000000000..c179f854b --- /dev/null +++ b/app/views/officing/voters/_can_vote.html.erb @@ -0,0 +1,16 @@ + +

+ <%= 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", + data: { disable_with: t("officing.voters.can_vote.submit_disable_with") } %> + <% end %> + diff --git a/app/views/officing/voters/new.html.erb b/app/views/officing/voters/new.html.erb index 212a9d8f8..a6ab32d33 100644 --- a/app/views/officing/voters/new.html.erb +++ b/app/views/officing/voters/new.html.erb @@ -18,31 +18,9 @@ <%= poll.name %> <% if poll.votable_by?(@user) %> - -

- <%= 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", - data: { disable_with: t("officing.voters.can_vote.submit_disable_with") } %> - <% end %> - + <%= render "can_vote", poll: poll %> <% else %> - -

- <%= t("officing.voters.show.error_already_voted") %> -

- - - <%= t("officing.voters.show.no_actions") %> - + <%= render "already_voted" %> <% end %> <% end %>