Created a Votes page

parent 670ee722
class VotesController < ApplicationController class VotesController < ApplicationController
def index
@votes = Vote.all
render "votes/index.html.erb"
end
end end
\ No newline at end of file
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
<% if user_signed_in? %> <% if user_signed_in? %>
<h2>Please take a look at our candidates!</h2> <h2>Please take a look at our candidates!</h2>
<hr> <hr>
<%= link_to "Manage Candidates", admin_candidates_path %> <%= link_to "Manage Candidates", admin_candidates_path %> ||
<%= link_to "Manage Positions", admin_positions_path %> <%= link_to "Manage Positions", admin_positions_path %> ||
<%= link_to "Manage Votes", votes_path %>
<hr> <hr>
<% @positions.each do |p| %> <% @positions.each do |p| %>
<h2>(<%= p.id %>.) <%= p.name %></h2> <h2>(<%= p.id %>.) <%= p.name %></h2>
......
<h1>Votes</h1>
<table width="100%">
<tr>
<th>#</th>
<th>User ID</th>
<th>Candidate</th>
<th>Position</th>
</tr>
<% @votes.each do |vote| %>
<tr>
<td><%= link_to "#{vote.id}", vote_path(vote.id) %></td>
<td><%= vote.user_id %></td>
<td>
<%= vote.candidate.first_name %> " <%= vote.candidate.nickname %> " <%= vote.candidate.last_name %>
</td>
<td>
<%= vote.candidate.position.name %>
</td>
</tr>
<% end %>
</table>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment