Commit 4d85676a authored by Galen Evilla's avatar Galen Evilla

added something

parent e955b633
module Users
class ProfileController < ApplicationController
class UsersController < ApplicationController
before_action :authenticate_user!
def index
@positions = Position.all
......
......@@ -6,11 +6,10 @@
<% @positions.each do |p| %>
<h5><%= p.name %></h5>
<ul >
<h2><%= p.name %></h2>
<ul>
<% p.candidates.each do |c|%>
<li><%=link_to c.full_name, admin_candidate_path(c.id)%></li>
<% end %>
</ul>
<% end %>
<% end %>
......@@ -3,12 +3,11 @@
<%=link_to "Add New Position", new_admin_position_path%>
<hr>
<% @positions.each do |c| %>
<h2>(<%= c.id %>) <%= c.name %></h2>
<ul>
<% c.candidates.each do |p| %>
<li><%= link_to "#{p.first_name} #{p.last_name}" , admin_candidate_path(p.id) %></li>
<% end %>
</ul>
<% @positions.each do |p| %>
<h2><%= link_to p.name, admin_position_path(p.id) %></h2>
<ul>
<% 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
<h1><%= @position.name%></h1>
<%=link_to "Edit", edit_admin_position_path(@position.id)%>
<br>
<%=link_to "Delete", admin_position_path(@position.id), method: :delete%>
<br>
<hr>
<h2>Candidates for <%=@position.name%></h2>
<h5>Candidates for <%=@position.name%></h5>
<ul>
<%@position.candidates.each do |c|%>
<li><%=link_to c.full_name, admin_candidate_path(c.id)%></li>
......
......@@ -13,27 +13,20 @@
<%@positions.each do |p|%>
<h4><%=p.name%></h4>
<table>
<thead>
<td>&nbsp;</td>
<td>Name</td>
<td>Slogan</td>
<td>Votes</td>
<td>&nbsp;</td>
</thead>
<%total = 0%>
<%p.candidates.each do |c|%>
<%total = total+c.votes.count%>
<%end%>
<%p.candidates.each do |c|%>
<tr>
<td></td>
<td><%=link_to c.full_name, admin_candidate_path(c.id)%></td>
<td><%=c.slogan%></td>
<td><%=c.votes.count%></td>
<td><progress value="<%=c.votes.count%>" max="<%=total%>" ></td>
</tr>
<%end%>
</table>
<table class="table table-striped table-bordered">
<tr>
<th>Name</th>
<th>Slogan</th>
<th>Total Votes</th>
</tr>
<%total = 0%>
<%p.candidates.each do |c|%>
<tr>
<td><%=link_to c.full_name, admin_candidate_path(c.id)%></td>
<td><%=c.slogan%></td>
<td><%=c.votes.count%> <progress value="<%=c.votes.count%>" max="<%=total%>" ></td>
</tr>
<%end%>
</table>
<%end%>
\ No newline at end of file
......@@ -5,7 +5,7 @@ Rails.application.routes.draw do
resources :users
get "/profile", to: "users/profile#index"
get "/profile", to: "users/users#index"
get "/voting/new/:id", to: "voting/votes#new"
get "/about" => "pages#about", as: :about
......
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