Create model for ratings
This commit is contained in:
parent
6682c8c300
commit
4b5685124c
4 changed files with 44 additions and 2 deletions
|
|
@ -4,16 +4,28 @@
|
|||
|
||||
<p>Hello, <%= current_user.email %>.</p>
|
||||
|
||||
<h2>Candidates</h2>
|
||||
<h2>Your ratings</h2>
|
||||
|
||||
<form action="/votes/<%= @vote.secure_id %>/ratings" method="post">
|
||||
<ul>
|
||||
<% @vote.candidates.each do |candidate| %>
|
||||
<li>
|
||||
<p><%= candidate.name %></p>
|
||||
<p><%= candidate.description %></p>
|
||||
<ol>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-7" value="7" <% if @ratings[candidate] and @ratings[candidate].value == 7 %>checked<% end %>><label for="<%= candidate.id %>-7">Excellent</label>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-6" value="6" <% if @ratings[candidate] and @ratings[candidate].value == 6 %>checked<% end %>><label for="<%= candidate.id %>-6">Very good</label>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-5" value="5" <% if @ratings[candidate] and @ratings[candidate].value == 5 %>checked<% end %>><label for="<%= candidate.id %>-5">Good</label>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-4" value="4" <% if @ratings[candidate] and @ratings[candidate].value == 4 %>checked<% end %>><label for="<%= candidate.id %>-4">Mediocre</label>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-3" value="3" <% if @ratings[candidate] and @ratings[candidate].value == 3 %>checked<% end %>><label for="<%= candidate.id %>-3">Bad</label>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-2" value="2" <% if @ratings[candidate] and @ratings[candidate].value == 2 %>checked<% end %>><label for="<%= candidate.id %>-2">Very bad</label>
|
||||
<input type="radio" name="<%= candidate.id %>" id="<%= candidate.id %>-1" value="1" <% if @ratings[candidate] and @ratings[candidate].value == 1 %>checked<% end %>><label for="<%= candidate.id %>-1">Awful</label>
|
||||
</ol>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
<button type="submit">Save ratings</button>
|
||||
</form>
|
||||
|
||||
<h2>New candidate</h2>
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue