Add color to ratings
This commit is contained in:
parent
c4ebe12408
commit
058b512b7d
4 changed files with 13 additions and 5 deletions
|
|
@ -5,6 +5,7 @@
|
|||
<title><%= _("Vote") %></title>
|
||||
<script src="/chartkick.js"></script>
|
||||
<script src="/Chart.bundle.js"></script>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<% if current_user %>
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
<td><%= user.email %></td>
|
||||
<% @vote.candidates.each do |candidate| %>
|
||||
<% if rating = @vote.ratings.find { |rating| rating.user == user and rating.candidate == candidate } %>
|
||||
<td><%= settings.values.select { |e| e[:id] == rating.value }.first[:label] %></td>
|
||||
<% value = settings.values.select { |e| e[:id] == rating.value }.first %>
|
||||
<td class="value-<%= value[:id] %>"><%= value[:label] %></td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tr>
|
||||
|
|
@ -39,7 +40,8 @@
|
|||
<tr>
|
||||
<td><%= i %></td>
|
||||
<td><%= candidate.name %></td>
|
||||
<td><%= settings.values.select { |e| e[:id] == candidate.mj.mj }.first[:label] %></td>
|
||||
<% value = settings.values.select { |e| e[:id] == candidate.mj.mj }.first %>
|
||||
<td class="value-<%= value[:id] %>"><%= value[:label] %></td>
|
||||
<td><%= candidate.mj.proponents %></td>
|
||||
<td><%= candidate.mj.opponents %></td>
|
||||
</tr>
|
||||
|
|
|
|||
|
|
@ -12,11 +12,11 @@
|
|||
<li>
|
||||
<p><%= candidate.name %></p>
|
||||
<p><%= candidate.description %></p>
|
||||
<ol>
|
||||
<ul>
|
||||
<% settings.values.reverse.each do |v| %>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-<%= v[:id] %>" value="<%= v[:id] %>" <% if value == v[:id] %>checked<% end %>><label for="<%= candidate.id %>-<%= v[:id] %>"><%= v[:label] %></label>
|
||||
<li><input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-<%= v[:id] %>" value="<%= v[:id] %>" <% if value == v[:id] %>checked<% end %>><label for="<%= candidate.id %>-<%= v[:id] %>" class="value-<%= v[:id] %>"><%= v[:label] %></label></li>
|
||||
<% end %>
|
||||
</ol>
|
||||
</ul>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue