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