From ea1cb054f27d0f8b0b0e21954e0c6060ba45ad37 Mon Sep 17 00:00:00 2001 From: ricola Date: Tue, 20 Jan 2026 21:43:11 -0600 Subject: [PATCH 1/3] Explain better which vote is removed --- views/style.erb | 4 ++++ views/votes_show_closed.erb | 22 ++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/views/style.erb b/views/style.erb index adc3ffc..2da46db 100644 --- a/views/style.erb +++ b/views/style.erb @@ -27,3 +27,7 @@ table:has(.mj-cell:hover) .mj-cell { border-right-width: 2px; border-color: var(--bs-body-color); } + +table:has(.mj-cell:hover) .mj-cell-majority { + background-color: white !important; +} diff --git a/views/votes_show_closed.erb b/views/votes_show_closed.erb index 85705e5..3559a14 100644 --- a/views/votes_show_closed.erb +++ b/views/votes_show_closed.erb @@ -86,6 +86,7 @@
<%= _("Votes for the winning candidate") %>
<% n = 0 %> + <% previous = 0 %> <% c.mj.break_tie(@results.first.mj).each do |a, b| %>
<% if n == 0 %> @@ -94,15 +95,24 @@ <% end %> <% if n == 1 %> + <% value = settings.values.select { |e| e[:id] == previous }.first %>
-
<%= _("Removing 1 vote.") %>
+
+ <%= _("Removing a vote of value: ") %> + <%= _(value[:label]) %> +
<% end %> <% if n > 1 %> + <% value = settings.values.select { |e| e[:id] == previous }.first %>
-
<%= _("Removing %{n} votes.") % { n: n } %>
+
+ <%= _("Removing another vote of value: ") %> + <%= _(value[:label]) %> +
<% end %> + <% previous = a.mj %> <% (1..a.n).each do |i| %> @@ -114,9 +124,11 @@ <% 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 %> From 720dd8cd565d88592bc70c88c4e3a88c1584906d Mon Sep 17 00:00:00 2001 From: ricola Date: Tue, 20 Jan 2026 21:56:19 -0600 Subject: [PATCH 2/3] Prevent flickering --- views/style.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/views/style.erb b/views/style.erb index 2da46db..e6f2c05 100644 --- a/views/style.erb +++ b/views/style.erb @@ -18,13 +18,14 @@ } .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; border-color: var(--bs-body-color); } From 4ac2aeaf5ebe0e5b8beb7ddfa423099a50f81209 Mon Sep 17 00:00:00 2001 From: ricola Date: Tue, 20 Jan 2026 22:24:58 -0600 Subject: [PATCH 3/3] 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 %> -
   @@ -124,9 +136,11 @@ <% if a.mj > b.mj %>><% end %> <% if a.mj == b.mj %>=<% 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 %> @@ -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 %>