From 4ac2aeaf5ebe0e5b8beb7ddfa423099a50f81209 Mon Sep 17 00:00:00 2001 From: ricola Date: Tue, 20 Jan 2026 22:24:58 -0600 Subject: [PATCH] Put all tiebreaker rounds in a single table To align votes vertically across rounds --- views/style.erb | 17 ++++++++-- views/votes_show_closed.erb | 65 ++++++++++++++++++------------------- 2 files changed, 46 insertions(+), 36 deletions(-) diff --git a/views/style.erb b/views/style.erb index e6f2c05..1918262 100644 --- a/views/style.erb +++ b/views/style.erb @@ -25,10 +25,23 @@ } <% end %> -table:has(.mj-cell:hover) .mj-cell { +.tiebreak td { + padding-left: 0; + padding-right: 0; +} + +tr:has(.mj-cell:hover) .mj-cell { border-color: var(--bs-body-color); } -table:has(.mj-cell:hover) .mj-cell-majority { +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 3559a14..c1a3b0a 100644 --- a/views/votes_show_closed.erb +++ b/views/votes_show_closed.erb @@ -85,40 +85,37 @@
<%= _("Votes for this candidate") %>
<%= _("Votes for the winning candidate") %>
- <% n = 0 %> - <% previous = 0 %> - <% c.mj.break_tie(@results.first.mj).each do |a, b| %> -
- <% 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 %> - +
+ <% 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 %> @@ -131,7 +128,7 @@ <% 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 %> @@ -144,9 +141,9 @@ <% end %> <% end %>
- <% n = n + 1 %> - <% end %> + <% n = n + 1 %> + <% end %> + <% end %>