diff --git a/views/style.erb b/views/style.erb index adc3ffc..1918262 100644 --- a/views/style.erb +++ b/views/style.erb @@ -18,12 +18,30 @@ } .mj-cell-<%= v[:id] %> { + border-left-width: 2px; + border-right-width: 2px; + border-color: <%= v[:color] %>; background-color: <%= v[:color] %> !important; } <% end %> -table:has(.mj-cell:hover) .mj-cell { - border-left-width: 2px; - border-right-width: 2px; +.tiebreak td { + padding-left: 0; + padding-right: 0; +} + +tr:has(.mj-cell:hover) .mj-cell { border-color: var(--bs-body-color); } + +tr:has(.mj-cell:hover) .mj-cell-majority { + background-color: white !important; +} + +.tiebreak-top td { + border-bottom: 1px solid var(--bs-gray-400); +} + +.tiebreak-round td { + padding-top: 15px; +} diff --git a/views/votes_show_closed.erb b/views/votes_show_closed.erb index 85705e5..c1a3b0a 100644 --- a/views/votes_show_closed.erb +++ b/views/votes_show_closed.erb @@ -85,54 +85,65 @@
<%= _("Votes for this candidate") %>
<%= _("Votes for the winning candidate") %>
- <% n = 0 %> - <% c.mj.break_tie(@results.first.mj).each do |a, b| %> -
- <% if n == 0 %> -
-
<%= _("Without removing any vote.") %>
-
- <% end %> - <% if n == 1 %> -
-
<%= _("Removing 1 vote.") %>
-
- <% end %> - <% if n > 1 %> -
-
<%= _("Removing %{n} votes.") % { n: n } %>
-
- <% end %> - +
+ <% n = 0 %> + <% previous = 0 %> + <% max = @results.first.mj.n * 2 + 1 %> + <% c.mj.break_tie(@results.first.mj).each do |a, b| %> + + + + + + <% (1..a.n).each do |i| %> <% end %> - + <% (1..b.n).each do |i| %> <% end %> + <% i = 0 %> <% settings.values.reverse.each do |v| %> <% (1..a.count[v[:id]]).each do |r| %> - + <% i = i + 1 %> + <% end %> <% end %> - + <% i = 0 %> <% settings.values.each do |v| %> <% (1..b.count[v[:id]]).each do |r| %> - + <% i = i + 1 %> + <% end %> <% end %> -
+ <% if n == 0 %> + <%= _("Without removing any vote.") %> + <% end %> + <% if n == 1 %> + <% value = settings.values.select { |e| e[:id] == previous }.first %> + <%= _("Removing a vote of value: ") %> + <%= _(value[:label]) %> + <% end %> + <% if n > 1 %> + <% value = settings.values.select { |e| e[:id] == previous }.first %> + <%= _("Removing another vote of value: ") %> + <%= _(value[:label]) %> + <% end %> + <% previous = a.mj %> +
   + <% if a.mj < b.mj %><<% end %> <% if a.mj > b.mj %>><% end %> <% if a.mj == b.mj %>=<% end %>   
- <% n = n + 1 %> - <% end %> + <% n = n + 1 %> + <% end %> + <% end %>