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


<body class = "gradientcontainer" >

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

    <h1 style="margin-left:100px;margin-top:150px;font-family: Impact">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 "Profile", "/profiles"%>&nbsp;&nbsp;<%= link_to('Log Out', destroy_user_session_path, :method => :delete) %></h4>

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

    </h4>

    <table width="100%" style="margin:100px;">
      <tr>
      <th>Candidate ID </th>
      <th>First Name</th>
      <th>Last Name</th>
      <th>Slogan</th>
      <th>Number of Votes</th>
      </tr>
    <% @candidates.each do |candidate| %>
      <tr>
      <td><%= candidate.id %></td>
      <td><%= candidate.first_name %></td>
      <td><%= candidate.last_name %></td>
      <td><%= candidate.slogan %></td>
      <td><%= candidate.votes.count %> </td>
      </tr>
    <% end %>
  </table>

<%= link_to "See Total Vote Count", votes_path %>

<hr>
<% @positions.each do |c| %>
  <h2>(<%= c.id %>) <%= c.name %></h2>
  <ul>
    <% c.candidates.each do |p| %>
      <li><%= link_to p.last_name, candidate_path(p.id) %></li>

    <% end %>
  </ul>
  <%= link_to "View all candidates", "/positions/#{c.id}" %>
<% end %>

</div>




</body>

