<link rel"stylesheet" type="text/css" href="application.css">


<body>

<div class="box fade-in one">


<h1 style="margin-left:100px;margin-top:100px;font-family:Droid Sans">Election 2016</h1>

<h3 style="color:#0080ff;margin-left:100px">
<%= link_to "MIS 21 - B DataBAES", "/about" %>
</h3>

<h4 style="color:#0080ff;margin-left:100px">
	<% if user_signed_in? %>
	  	Hello <%= current_user.email %>! <br>
	  	<h4 style="margin-left:100px">
      <%= link_to "Vote", vote_path %>&nbsp;&nbsp;
      <%= link_to "Votes Record", vote_history_path %>&nbsp;&nbsp;
      <%= link_to("Back to Home", root_path) %>&nbsp;&nbsp;
      <%= link_to('Log Out', destroy_user_session_path, :method => :delete) %> &nbsp;&nbsp;
      </h4>

	<% else %>
		<h5 style="color:#0080ff;margin-left:100px">
			You're not signed in.
			<%= link_to "Login", new_user_session_path %>
			<%= link_to "Register", new_user_registration_path %>
      <%= link_to "Admin", admin_candidates_path %>
		</h5>
	<% end %>

</h4>

<table width="100%" style="margin:100px;">
  <tr>
    <th>Position</th>
    <th>First Name</th>
    <th>Last Name</th>
    <th>Slogan</th>
    <th>Number of Votes</th>
  </tr>
  <% @candidates.each do |position_id, candidates| %>

    <%= Position.find(position_id).name %>

    <tr>
      <% candidates.each do |candidate|%>
    </tr>
      
    <tr>
      <td><%= candidate.position_id %></td>
      <td><%= candidate.first_name %></td>
      <td><%= candidate.last_name %></td>
      <td><%= candidate.slogan %></td>
    </tr>
      <% end %>
  <% end %>
</table>





</div>




</body>

