Put all tiebreaker rounds in a single table
To align votes vertically across rounds
This commit is contained in:
parent
720dd8cd56
commit
4ac2aeaf5e
2 changed files with 46 additions and 36 deletions
|
|
@ -25,10 +25,23 @@
|
||||||
}
|
}
|
||||||
<% end %>
|
<% 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);
|
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;
|
background-color: white !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tiebreak-top td {
|
||||||
|
border-bottom: 1px solid var(--bs-gray-400);
|
||||||
|
}
|
||||||
|
|
||||||
|
.tiebreak-round td {
|
||||||
|
padding-top: 15px;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -85,40 +85,37 @@
|
||||||
<div class="col"><%= _("Votes for this candidate") %></div>
|
<div class="col"><%= _("Votes for this candidate") %></div>
|
||||||
<div class="col text-end"><%= _("Votes for the winning candidate") %></div>
|
<div class="col text-end"><%= _("Votes for the winning candidate") %></div>
|
||||||
</div>
|
</div>
|
||||||
<% n = 0 %>
|
<table class="table table-borderless tiebreak">
|
||||||
<% previous = 0 %>
|
<% n = 0 %>
|
||||||
<% c.mj.break_tie(@results.first.mj).each do |a, b| %>
|
<% previous = 0 %>
|
||||||
<hr>
|
<% max = @results.first.mj.n * 2 + 1 %>
|
||||||
<% if n == 0 %>
|
<% c.mj.break_tie(@results.first.mj).each do |a, b| %>
|
||||||
<div class="row">
|
<tr class="tiebreak-top">
|
||||||
<div class="col"><%= _("Without removing any vote.") %></div>
|
<td colspan="<%= max %>"></td>
|
||||||
</div>
|
</tr>
|
||||||
<% end %>
|
<tr class="tiebreak-round">
|
||||||
<% if n == 1 %>
|
<td colspan="<%= max %>">
|
||||||
<% value = settings.values.select { |e| e[:id] == previous }.first %>
|
<% if n == 0 %>
|
||||||
<div class="row">
|
<%= _("Without removing any vote.") %>
|
||||||
<div class="col">
|
<% end %>
|
||||||
<%= _("Removing a vote of value: ") %>
|
<% if n == 1 %>
|
||||||
<span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></span>
|
<% value = settings.values.select { |e| e[:id] == previous }.first %>
|
||||||
</div>
|
<%= _("Removing a vote of value: ") %>
|
||||||
</div>
|
<span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if n > 1 %>
|
<% if n > 1 %>
|
||||||
<% value = settings.values.select { |e| e[:id] == previous }.first %>
|
<% value = settings.values.select { |e| e[:id] == previous }.first %>
|
||||||
<div class="row">
|
<%= _("Removing another vote of value: ") %>
|
||||||
<div class="col">
|
<span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></span>
|
||||||
<%= _("Removing another vote of value: ") %>
|
<% end %>
|
||||||
<span class="badge bg-<%= value[:id] %>"><%= _(value[:label]) %></span>
|
<% previous = a.mj %>
|
||||||
</div>
|
</td>
|
||||||
</div>
|
</tr>
|
||||||
<% end %>
|
|
||||||
<% previous = a.mj %>
|
|
||||||
<table class="table table-borderless">
|
|
||||||
<tr>
|
<tr>
|
||||||
<% (1..a.n).each do |i| %>
|
<% (1..a.n).each do |i| %>
|
||||||
<td class="p-0 text-center <% unless i == a.majority %>opacity-0<% end %>">↓</td>
|
<td class="p-0 text-center <% unless i == a.majority %>opacity-0<% end %>">↓</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<th></th>
|
<td colspan="<%= max - a.n - b.n %>"></td>
|
||||||
<% (1..b.n).each do |i| %>
|
<% (1..b.n).each do |i| %>
|
||||||
<td class="p-0 text-center <% unless b.n - i + 1 == b.majority %>opacity-0<% end %>">↓</td>
|
<td class="p-0 text-center <% unless b.n - i + 1 == b.majority %>opacity-0<% end %>">↓</td>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
@ -131,7 +128,7 @@
|
||||||
<td class="p-0 mj-cell mj-cell-<%= v[:id] %><% if i == a.majority and a.mj == b.mj %> mj-cell-majority<% end %>"> </td>
|
<td class="p-0 mj-cell mj-cell-<%= v[:id] %><% if i == a.majority and a.mj == b.mj %> mj-cell-majority<% end %>"> </td>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<td class="p-0 text-center fw-bold">
|
<td class="p-0 text-center fw-bold" colspan="<%= max - a.n - b.n %>">
|
||||||
<% if a.mj < b.mj %><<% end %>
|
<% if a.mj < b.mj %><<% end %>
|
||||||
<% if a.mj > b.mj %>><% end %>
|
<% if a.mj > b.mj %>><% end %>
|
||||||
<% if a.mj == b.mj %>=<% end %>
|
<% if a.mj == b.mj %>=<% end %>
|
||||||
|
|
@ -144,9 +141,9 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
<% n = n + 1 %>
|
||||||
<% n = n + 1 %>
|
<% end %>
|
||||||
<% end %>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue