Add feedback when voting

This commit is contained in:
ricola 2026-01-09 15:35:33 -06:00
parent a93ae1269b
commit da30b02405
3 changed files with 16 additions and 2 deletions

View file

@ -14,6 +14,11 @@
<% when 'closed' %>
<SPAN class="badge bg-dark"><%= _("Closed") %></span>
<% end %>
<% if vote.ratings.find { |rating| rating.user == current_user } %>
<span class="badge bg-success"><%= _("Voted") %></span>
<% elsif vote.state == 'open' %>
<span class="badge bg-danger"><%= _("Not voted") %></span>
<% end %>
<% if vote.users.exists?(current_user.id) %>
<span class="badge bg-warning text-bg-warning"><%= _("Organizer") %></span>
<% end %>

View file

@ -3,6 +3,11 @@
<ul class="list-unstyled">
<li>
<span class="badge bg-primary"><%= _("Open") %></span>
<% if @vote.ratings.find { |rating| rating.user == current_user } %>
<span class="badge bg-success"><%= _("Voted") %></span>
<% else %>
<span class="badge bg-danger"><%= _("Not voted") %></span>
<% end %>
</li>
<% if @vote.expire_on %>
<li><%= _("Closes on %{date}") % { date: format_date_and_time(@vote.expire_on) } %></li>
@ -26,6 +31,10 @@
<% end %>
<% end %>
<% if @voted %>
<p class="alert alert-success mb-4"><%= _("Gràcies per votar!") %></p>
<% end %>
<form action="/votes/<%= @vote.secure_id %>/ratings" method="post" class="mb-5">
<% @vote.candidates.each do |candidate| %>