Commit e296d3d4 authored by Wills Gomez's avatar Wills Gomez

fixed the nav bar and other page changes

parent 37e830e0
<h1>Name of the Candidate: <%= @candidate.full_name%></h1> <h1><center><%= @candidate.full_name%></center></h1>
<%=link_to "Edit", edit_admin_candidate_path(@candidate.id)%> <center><%=link_to "Edit", edit_admin_candidate_path(@candidate.id)%>
<br> <%=link_to "Delete", admin_candidate_path(@candidate.id), method: :delete%></center>
<%=link_to "Delete", admin_candidate_path(@candidate.id), method: :delete%>
<br> <br>
<h3>Position: <%= @candidate.position.name %></h3> <h3>Position: <%= @candidate.position.name %></h3>
<% <%
......
<h1>Positions</h1> <h1><center>POSITIONS</center></h1>
<center><%=link_to "Add New Position", new_admin_position_path%></center>
<%=link_to "Add New Position", new_admin_position_path%>
<hr> <hr>
<% @positions.each do |c| %> <% @positions.each do |c| %>
......
...@@ -14,19 +14,20 @@ ...@@ -14,19 +14,20 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li><a href="/profile">Hello, <%= current_user.first_name%>!</a></li>
<li><%= link_to "Home", root_path %></li> <li><%= link_to "Home", root_path %></li>
<li><%= link_to "Candidates", admin_candidates_path %></li> <li><%= link_to "Candidates", admin_candidates_path %></li>
<li><%= link_to "Positions", admin_positions_path %></li> <li><%= link_to "Positions", admin_positions_path %></li>
<li><a href="/voting/votes">Vote now</li>
<li> <a href="/about">About</a> </li> <li> <a href="/about">About</a> </li>
<%if user_signed_in?%> <%if user_signed_in?%>
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Hello, <%= current_user.first_name%>!<b class="caret"></b></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li> <a href="/profile">My Profile</a> </li> <li><a href="/voting/votes">Vote now</li>
<li><%= link_to "Logout", destroy_user_session_path, method: :delete %></li> <li><%= link_to "Logout", destroy_user_session_path, method: :delete %></li>
</u1> </u1>
</li> </li>
<%else%> <%else%>
......
<div class ="index"> <div class ="index">
<h1><center>Current Vote Tally</center></h1> <h1><center>Current Vote Tally</center></h1>
<br> <br>
<br> <br>
<% if user_signed_in? %>
<% case current_user.role %>
<% when 'voter' %>
<h3>Welcome, Voter</h3>
<% when 'admin' %>
<h3>Welcome, Administrator</h3>
<% end %>
<% else %>
<h3>Welcome</h3>
<% end %>
<%@positions.each do |p|%> <%@positions.each do |p|%>
<div class ="section"> <div class ="section">
<div class ="box"> <div class ="box">
<h4><center><%=p.name%></center></h4> <h2><center><%=p.name%></center></h2>
<table> <table>
<thead> <thead>
<th><center>&nbsp;</center></th> <th><center>&nbsp;</center></th>
<th><center>Name</center></th> <th><center>Name</center></th>
<th colspan="2"><center>Votes</center></th> <th><center>Votes</center></th>
<th><center>&nbsp;</center></th> <th><center>&nbsp;</center></th>
</thead> </thead>
<%total = 0%> <%total = 0%>
...@@ -35,7 +26,6 @@ ...@@ -35,7 +26,6 @@
<td></td> <td></td>
<td><center><%=link_to c.full_name, admin_candidate_path(c.id)%></center></td> <td><center><%=link_to c.full_name, admin_candidate_path(c.id)%></center></td>
<td><center><%=c.votes.count%></center></td> <td><center><%=c.votes.count%></center></td>
<td><center><progress value="<%=c.votes.count%>" max="<%=total%>" >(<%=c.votes.count%>)</center></td>
</tr> </tr>
<%end%> <%end%>
</table> </table>
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<% p.candidates.each do |c|%> <% p.candidates.each do |c|%>
<%c.votes.each do |v|%> <%c.votes.each do |v|%>
<%if v.user_id == current_user.id%> <%if v.user_id == current_user.id%>
You have already voted for <%= v.candidate.full_name%> - <%= v.candidate.full_name%>
<%voted_for = true%> <%voted_for = true%>
<% end %> <% end %>
<%end%> <%end%>
......
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