Commit aa2be4cf authored by Vincent Agbayani's avatar Vincent Agbayani

macasaet- comments, gozum-vote record, gonzales- delete, agbayani-userarchive

parent 5d136e98
......@@ -42,7 +42,7 @@ class CandidatesController < ApplicationController
end
def destroy
Candidate.find(params[:id]).delete_all
Candidate.find(params[:id]).destroy
redirect_to admin_candidates_path
end
......
......@@ -43,7 +43,7 @@ class CandidatesController < ApplicationController
render "candidates/show.html.erb"
end
def destroy
def delete_all
Candidate.where(params[:id]).delete_all
redirect_to candidates_path
end
......
......@@ -18,17 +18,22 @@ class PagesController < ApplicationController
id = params[:id]
@user = User.find(id.to_i)
@votes = current_user.votes
@votes.each do |x|
@archive = Userarchive.new
@archive.name = @user.email
@archive.candidate = "#{x.candidate.first_name} #{x.candidate.last_name}"
@archive.position = x.candidate.position_id
@archive.position = x.candidate.position.name
@archive.save
end
@user.destroy!
@user.destroy
redirect_to users_path
end
def archive
@archive = Userarchive.all
render "users/archive.html.erb"
end
end
......@@ -38,7 +38,7 @@
<tbody>
<tr>
<% @candidates.each do |a| %>
<td><%= a.position.name %></td>
<td><%= a.position.name %></td>
<td><%= a.first_name %></td>
<td><%= a.last_name %></td>
<td><%= a.nickname %></td>
......
......@@ -7,6 +7,20 @@
<%= csrf_meta_tags %>
</head>
<body>
<div class = "container-fluid">
<nav class="navbar navbar-inverse navbar-fixed-top ">
<ul class="nav navbar-nav navbartxt">
<li class="active"><%= link_to "HOME", root_path %></li>
<li ><%= link_to "VOTE TALLY", candidates_list_path %></li>
<li><%= link_to "CANDITATE LIST", candidates_path %></li>
<li><%= link_to "VOTES RECORD", vote_history_path %></li>
<li><%= link_to "ABOUT", about_path %></li>
<li><a href = "/users">USERS</a><li>
</ul>
</nav>
</div>
<% if user_signed_in? %>
Welcome, <%= current_user.email %>! Your voter id is <%= current_user.id %>!
......
......@@ -43,25 +43,25 @@
<%= image_tag "designer.png", class:"pull-right" %>
<h1>John Vincent Agbayani</h1>
<h2>Designer</h2>
<h2>Lead Designer/Associate Developer</h2>
</div>
<div id="section2" class="container-fluid">
<%= image_tag "developer.png", size:"336x150", class:"pull-right" %>
<h1>Henry Gonzales</h1>
<h2>Developer</h2>
<h2>Lead Developer</h2>
</div>
<div id="section3" class="container-fluid">
<%= image_tag "designer.png", class:"pull-right" %>
<h1>Jan Paulo Gozum</h1>
<h2>Designer</h2>
<h2>Associate Designer/Associate Developer</h2>
</div>
<div id="section41" class="container-fluid">
<%= image_tag "developer.png", size:"336x150", class:"pull-right" %>
<h1>Juan Paulo Macasaet</h1>
<h2>Developer</h2>
<h2>Lead Developer</h2>
</div>
......
<div class = "container-fluid">
<nav class="navbar navbar-inverse navbar-fixed-top ">
<ul class="nav navbar-nav navbartxt">
<li class="active"><%= link_to "HOME", root_path %></li>
<li ><%= link_to "VOTE TALLY", candidates_list_path %></li>
<li><%= link_to "CANDITATE LIST", candidates_path %></li>
<li><%= link_to "VOTES RECORD", vote_history_path %></li>
<li><%= link_to "ABOUT", about_path %></li>
<li><a href = "/users">USERS</a><li>
</ul>
</nav>
<br><br><br>
<div class = "row">
<div class = "col-md-2 col-md-offset-2">
......
<br><br>
<table>
<th>USER</th>
<th>CANDIDATE</th>
<th>POSITION</th>
<% @archive.each do |a| %>
<tr>
<td><%= a.name %></td>
<td><%= a.candidate %></td>
<td><%= a.position %></td>
<% end %>
</tr>
</table>
\ No newline at end of file
<h1>test</h1>
<br><br>
<table>
<tr>
<th>USERS</th>
......@@ -17,9 +17,5 @@
<% end %>
</tr>
</table>
<% @archive.each do |a| %>
<h1><%= a.name %></h1>
<h1><%= a.candidate %></h1>
<h1><%= a.position %></h1>
<% end %>
\ No newline at end of file
<br>
<a href = "/archive" class = "btn btn-primary">View Archived Users</a>
\ No newline at end of file
......@@ -5,6 +5,7 @@ Rails.application.routes.draw do
get "/about", to: "pages#about"
get "/user_profile", to: "votes#user_profile"
get "/delete/:id", to: "pages#archive_user"
get "/archive", to: "pages#archive"
get "/users", to: "pages#users_summary"
get "/users_summary", to: "users#users_summary"
resources :candidates
......
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