Commit c172c99b authored by Wills Gomez's avatar Wills Gomez

fixed nav bar and other page changes

parents e296d3d4 2920b041
class PagesController < ApplicationController
def index
@users = User.all
@votes = Vote.all
@candidates = Candidate.all
@positions = Position.all
......
<h1>Admin Edit Post</h1>
<% provide(:candidate, "active") %>
<% provide(:title, "Edit Candidate" ) %>
<h1>Edit Candidate's Information</h1>
<%= render partial: "form" %>
......
<% provide(:candidate, "active") %>
<% provide(:title, "Candidates") %>
<center>
<h1>CANDIDATES</h1>
<h1>CANDIDATES</h1>
<%=link_to "Add a candidate", new_admin_candidate_path%>
</center>
<hr>
<% @positions.each do |p| %>
<h3><%= p.name %></h3>
<ul>
<% p.candidates.each do |c|%>
<li><%=link_to c.full_name, admin_candidate_path(c.id)%></li>
<% end %>
</ul>
<%@positions.each do |p|%>
<div class ="section">
<div class ="box">
<h4><center><%=p.name%></center></h4>
<table>
<thead>
<th><center>&nbsp;</center></th>
<th><center>Name</center></th>
<th><center>Slogan</center></th>
<th><center>&nbsp;</center></th>
</thead>
<%p.candidates.each do |c|%>
<tr>
<td></td>
<td><center><%=link_to c.full_name, admin_candidate_path(c.id)%></center></td>
<td><center><%=c.slogan%></center></td>
</tr>
<%end%>
</table>
</div>
</div>
<% end %>
<% provide(:candidate, "active") %>
<% provide(:title, "New Candidate" ) %>
<h1>New Candidate</h1>
<%= render partial: "form" %>
......
<<<<<<< HEAD
<h1><center><%= @candidate.full_name%></center></h1>
<center><%=link_to "Edit", edit_admin_candidate_path(@candidate.id)%>
<%=link_to "Delete", admin_candidate_path(@candidate.id), method: :delete%></center>
=======
<% provide(:candidate, "active") %>
<% provide(:title, "#{@candidate.full_name}" ) %>
<h1>Name of the Candidate: <%= @candidate.full_name%></h1>
<%=link_to "Edit", edit_admin_candidate_path(@candidate.id)%>
<br>
<%=link_to "Delete", admin_candidate_path(@candidate.id), method: :delete%>
>>>>>>> 2920b0418adc40c16be842ad29c33a2aefaa3052
<br>
<h3>Position: <%= @candidate.position.name %></h3>
<%
m=0
f=0
o=0
l=0
@candidate.votes.each do |v|
if v.user != nil
if v.user.gender=="Male"
......@@ -15,7 +25,7 @@
if v.user.gender=="Female"
f=f+1
else
o=o+1
l=l+1
end
end
end
......@@ -30,13 +40,13 @@
<tr>
<th>Male Voters</th>
<th>Female Voters</th>
<th>Other Voters</th>
<th>LGBT Voters</th>
<th>Total Votes</th>
</tr>
<tr>
<td><%= m%></td>
<td><%= f%></td>
<td><%= o%></td>
<td><%= m%> <progress value="<%= m%>" max="<%= @candidate.votes.count %>" > </td>
<td><%= f%> <progress value="<%= f%>" max="<%= @candidate.votes.count %>" ></td>
<td><%= l%> <progress value="<%= l%>" max="<%= @candidate.votes.count %>" ></td>
<td><%= @candidate.votes.count %></td>
</tr>
</table>
......
<h1>Admin Edit Post</h1>
<% provide(:position, "active") %>
<% provide(:title, "Edit Position" ) %>
<h1>Edit Position</h1>
<%= render partial: "form" %>
......
<<<<<<< HEAD
<h1><center>POSITIONS</center></h1>
<center><%=link_to "Add New Position", new_admin_position_path%></center>
=======
<% provide(:position, "active") %>
<% provide(:title, "Positions") %>
<h1>Positions</h1>
>>>>>>> 2920b0418adc40c16be842ad29c33a2aefaa3052
<hr>
<% @positions.each do |c| %>
<h2><%= c.name %></h2>
<% @positions.each do |p| %>
<h2><%= link_to p.name, admin_position_path(p.id) %></h2>
<ul>
<% c.candidates.each do |p| %>
<li><%= link_to "#{p.first_name} #{p.last_name}" , admin_candidate_path(p.id) %></li>
<% p.candidates.each do |c|%>
<li><%=link_to c.full_name, admin_candidate_path(c.id)%></li>
<% end %>
</ul>
<% end %>
\ No newline at end of file
<% provide(:position, "active") %>
<% provide(:title, "New Position" ) %>
<h1>New Position</h1>
<%= render partial: "form" %>
......
<% provide(:position, "active") %>
<% provide(:title, "#{@position.name}" ) %>
<h1><%= @position.name%></h1>
<%=link_to "Edit", edit_admin_position_path(@position.id)%>
......
......@@ -8,7 +8,7 @@
<%= f.input :first_name, required: true, autofocus: true %>
<%= f.input :last_name, required: true %>
<%= f.input :birthday, :end_year => Date.today.year - 18, :start_year => 1920, :order => [ :day, :month, :year], required: true %>
<%= f.input :gender, as: :select, collection: ["Male", "Female", "Other"], required: true %>
<%= f.input :gender, as: :select, collection: ["Male", "Female", "LGBT"], required: true %>
<%= f.input :email, required: true %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
......
......@@ -9,7 +9,7 @@
<%=
f.input :birthday, :start_year => Date.today.year - 18, :end_year => 1920, :order => [ :day, :month, :year], :required => true
%>
<%= f.input :gender, as: :select, collection: ["Male", "Female", "Other"], required: true %>
<%= f.input :gender, as: :select, collection: ["Male", "Female", "LGBT"], required: true %>
<%= f.input :email, required: true %>
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
<%= f.input :password_confirmation, required: true %>
......
......@@ -14,12 +14,20 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<<<<<<< HEAD
<li><a href="/profile">Hello, <%= current_user.first_name%>!</a></li>
<li><%= link_to "Home", root_path %></li>
<li><%= link_to "Candidates", admin_candidates_path %></li>
<li><%= link_to "Positions", admin_positions_path %></li>
<li> <a href="/about">About</a> </li>
=======
<li class="<%= yield(:home) %>" ><%= link_to "Home", root_path %></li>
<li class="<%= yield(:candidate) %>" ><%= link_to "Candidates", admin_candidates_path %></li>
<li class="<%= yield(:position) %>" ><%= link_to "Positions", admin_positions_path %></li>
<li class="<%= yield(:vote) %>" ><a href="/voting/votes">Vote now</li>
<li class="<%= yield(:about) %>" ><%= link_to "About", about_path %></li>
>>>>>>> 2920b0418adc40c16be842ad29c33a2aefaa3052
<%if user_signed_in?%>
<li class="dropdown">
......
<!DOCTYPE html>
<html>
<head>
<title>Halalan PH</title>
<title><%= yield(:title) %> | Halalan PH</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
......
<<<<<<< HEAD
=======
<% provide(:home, "active") %>
<% provide(:title, "Home") %>
>>>>>>> 2920b0418adc40c16be842ad29c33a2aefaa3052
<div class ="index">
<h1><center>Current Vote Tally</center></h1>
<br>
<br>
<<<<<<< HEAD
=======
<% if user_signed_in? %>
<% case current_user.role %>
<% when 'voter' %>
<h3>Welcome, <%= current_user.first_name%>! </h3>
<% when 'admin' %>
<h3>Welcome, Administrator</h3>
<% end %>
<% else %>
<h3>Welcome</h3>
<% end %>
>>>>>>> 2920b0418adc40c16be842ad29c33a2aefaa3052
<%@positions.each do |p|%>
<div class ="section">
......@@ -26,6 +44,10 @@
<td></td>
<td><center><%=link_to c.full_name, admin_candidate_path(c.id)%></center></td>
<td><center><%=c.votes.count%></center></td>
<<<<<<< HEAD
=======
<td><center><progress value="<%=c.votes.count%>" max="<%=@users.count%>" >(<%=c.votes.count%>)</center></td>
>>>>>>> 2920b0418adc40c16be842ad29c33a2aefaa3052
</tr>
<%end%>
</table>
......
<h1>Admin Edit Post</h1>
<%= render partial: "form" %>
<%= link_to "Back to Posts", admin_posts_path %>
\ No newline at end of file
<% provide(:vote, "active") %>
<% provide(:title, "Vote now!") %>
<h1><center>VOTES</center></h1>
......
<% provide(:vote, "active") %>
<% provide(:title, "Vote") %>
<h1>Vote</h1>
<%= render partial: "form" %>
......
<h1><%= @post.title %></h1>
<h3><%= @post.published_at %></h3>
<p>
<%= @post.content %>
</p>
<hr>
<%= link_to "Back to Posts", admin_posts_path %>
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