Commit 58e59186 authored by Jego Reyes's avatar Jego Reyes

admin

parent 6b7fe333
No preview for this file type
File mode changed from 100644 to 100755
No preview for this file type
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -6,6 +6,9 @@ class VotesController < ApplicationController
@candidates = Candidate.all.group_by(&:position_id)
end
def profiles
render "/votes/profiles.html.erb"
end
def vote
@vote = Vote.new
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
No preview for this file type
<link rel"stylesheet" type="text/css" href="application.css">
<%= simple_form_for([:admin,@candidate]) do |f| %>
<%= f.association :position %>
<%= f.input :first_name %>
<%= f.input :last_name %>
<%= f.input :nickname %>
<%= f.input :slogan %>
<%= f.submit %>
<% end %>
......@@ -4,42 +4,40 @@
Election 2016
</h1>
<h5 style="margin-left:50px";>
<h2 style="margin-left:50px";>
Candidates
</h5>
</h2>
<h5> <%= link_to "Add Candidate", new_admin_candidate_path %>
<hr>
<% if user_signed_in? %>
<h5 style="margin-left:50px;">Hello <%= current_user.email %>! Your user ID is <%= current_user.id%>.</h5>
<hr>
<table width="100%" style="margin:100px;">
<table width="100%", align="center">
<tr>
<th>Position</th>
<th>First Name</th>
<th>Last Name</th>
<th>Nickname</th>
<th> Nickname</th>
<th>Slogan</th>
</tr>
<% @candidates.each do |c| %>
<% @candidates.each do |a| %>
<tr>
<td><%= c.position.name %></td>
<td><%= c.first_name %></td>
<td><%= c.last_name %></td>
<td><%= c.nickname %></td>
<td><%= c.slogan %></td>
<td><%= a.position.name %></td>
<td><%= a.first_name %></td>
<td><%= a.last_name %></td>
<td><%= a.nickname %></td>
<td><%= a.slogan %></td>
<td>
<%= link_to "Show ", candidate_path(candidate.id) %>
<%= link_to "Show", candidate_path(a.id) %>
<%= link_to "Edit", edit_admin_candidate_path(a.id) %>
<%= link_to "Delete", admin_candidate_path(a.id), method: :delete, data: { confirm: 'Are you sure?' } %>
</td>
</tr>
<% end %>
</table>
<br>
<h4 style="margin:100px;"><%= link_to "Home", root_path %></h4>
<% end %>
\ No newline at end of file
<link rel"stylesheet" type="text/css" href="application.css">
<h1>Edit Candidate</h1>
<%= render partial: "form" %>
<%= link_to "Back to Candidates", admin_candidates_path %>
<link rel"stylesheet" type="text/css" href="application.css">
<body>
<div class="box fade-in one">
<h1 style="margin-left:100px;margin-top:100px;font-family:Droid Sans">Election 2016</h1>
<h3 style="color:#0080ff;margin-left:100px">
<%= link_to "MIS 21 - B DataBAES", "/about" %>
</h3>
<h4 style="color:#0080ff;margin-left:100px">
<% if user_signed_in? %>
Hello <%= current_user.email %>! <br>
<h4 style="margin-left:100px"><%= link_to "Profile", "/profiles"%>&nbsp;&nbsp;<%= link_to('Log Out', destroy_user_session_path, :method => :delete) %></h4>
<% else %>
<h5 style="color:#0080ff;margin-left:100px">
You're not signed in.
<%= link_to "Login", new_user_session_path %>
<%= link_to "Register", new_user_registration_path %>
<%= link_to "Admin", "admin/index.html.erb" %>
</h5>
<% end %>
</h4>
<h2> List of Candidate </h2>
<%= link_to("Add Candidate", new_admin_candidate_path) %>
<table width="100%" style="margin:100px;">
<tr>
<th>Candidate ID </th>
<th>First Name</th>
<th>Last Name</th>
<th>Slogan</th>
<th>Number of Votes</th>
</tr>
<% @candidates.each do |candidate| %>
<tr>
<td><%= candidate.id %></td>
<td><%= candidate.first_name %></td>
<td><%= candidate.last_name %></td>
<td><%= candidate.slogan %></td>
<td><%= candidate.votes.count %> </td>
<td><%= link_to "Show ", candidate_path(candidate.id) %>
<%= link_to "Edit", edit_candidate_path(candidate.id) %>
<%= link_to "Delete", candidate_path(candidate.id), method: :delete, data: { confirm: 'Are you sure?'} %> </td>
</tr>
<% end %>
</table>
</div>
</body>
<link rel"stylesheet" type="text/css" href="application.css">
<h1>New Candidate</h1>
<%= render partial: "form" %>
<%= link_to "Back to Candidates", admin_candidates_path %>
<link rel"stylesheet" type="text/css" href="application.css">
<h1><%= @candidate.nickname %></h1>
<br>
<ul>
<li><%= @candidate.first_name %></li>
<li><%= @candidate.last_name %></li>
<li><%= @candidate.slogan %></li>
</ul>
<hr>
<%= link_to "Back to Candidates", admin_candidates_path %>
File mode changed from 100644 to 100755
......@@ -9,7 +9,7 @@
<div class="form-inputs">
<%= f.input :first_name, required: true, autofocus: true %>
<%= f.input :last_name, required: true, autofocus: true %>
<%= f.input :birthday, required: true, autofocus: true %>
<%= f.input :birthday, required: true, autofocus: true, start_year: 1900, end_year: 1998 %>
<%= f.input :gender, required: true, as: :select, :collection => ['Female', 'Male'], autofocus: true %>
<%= f.input :email, required: true, autofocus: true %>
<%= f.input :password, required: true, hint: ("#{@minimum_password_length} characters minimum" if @minimum_password_length) %>
......
File mode changed from 100644 to 100755
<link rel"stylesheet" type="text/css" href="application.css">
<h1>Election 2016</h1>
<h3>Hello <%= current_user.first_name%> <%= current_user.last_name %>!</h3>
<ul>
<li> Email: <%= current_user.email %> </li>
<li> Birthday: <%= current_user.birthday %> </li>
<li> Sex: <%= current_user.gender %> </li>
<li> Password: <%= current_user.password %> </li>
</ul>
<table width="100%" style="margin:100px;">
<tr>
<th>Candidate ID </th>
<th>First Name</th>
<th>Last Name</th>
<th>Slogan</th>
</tr>
<% @candidates.each do |candidate| %>
<tr>
<td><%= candidate.id %></td>
<td><%= candidate.first_name %></td>
<td><%= candidate.last_name %></td>
<td><%= candidate.slogan %></td>
<!--<td>
<%= link_to "Show ", candidate_path(candidate.id) %> |
<%= link_to "Edit", edit_candidate_path(candidate.id) %>
<%= link_to "Delete", candidate_path(candidate.id), method: :delete, data: { confirm: 'Are you sure?'} %>
</td> -->
</tr>
<% end %>
</table>
\ No newline at end of file
<link rel"stylesheet" type="text/css" href="application.css">
<%= simple_form_for(@position) do |p| %>
<%= p.input :name, as: :select, collection: ["President", "Vice President", "Senator"] %>
<%= p.submit %>
<% end %>
<link rel"stylesheet" type="text/css" href="application.css">
<h1>Edit Candidate</h1>
<%= render partial: "form" %>
<%= link_to "Back", positions_path %>
<link rel"stylesheet" type="text/css" href="application.css">
<h1 style="font-family:'Droid Sans';margin-left:50px;margin-top:50px;">
Election 2016
</h1>
<h5 style="margin-left:50px";>
<%= link_to "Add Position", new_position_path %>
<%= link_to "Add Candidate", new_candidate_path %>
</h5>
<hr>
<% if user_signed_in? %>
Hello <%= current_user.email %>! Your user ID is <%= current_user.id%>.
<hr>
<table width="100%">
<tr>
<th>Position</th>
</tr>
<% @positions.each do |position| %>
<tr>
<td><%= position.name %></td>
<td>
<%= link_to "Show ", position_path(position.id) %> |
<%= link_to "Edit", edit_position_path(position.id) %> |
<%= link_to "Delete", position_path(position.id), method: :delete, data: { confirm: 'Are you sure?'} %>
</td>
</tr>
<% end %>
</table>
<br>
<%= link_to "Go to Candidates", candidates_path %> |
<%= link_to "Home", root_path %>
<% else %>
<h3>
You are not signed in. Please <%= link_to "Login", new_user_session_path %>
</h3>
<% end %>
\ No newline at end of file
<link rel"stylesheet" type="text/css" href="application.css">
<h1>Add Position</h1>
<%= render partial: "form" %>
<%= link_to "Back", candidates_path %>
\ No newline at end of file
<link rel"stylesheet" type="text/css" href="application.css">
<h1>Ballot</h1>
<% @candidates.each do |position_id, candidates| %>
<%= simple_form_for(@vote, url: confirm_vote_path, method: :post) do |o| %>
<%= Position.find(position_id).name %>
<ul>
<li><%= o.association :candidate, :collection => candidates %></li>
<li><%= o.input :comments %></li>
</ul>
<%= o.button :submit, "Vote" %>
<% end %>
<%= link_to "Back", candidates_list_path %>
<% end %>
\ No newline at end of file
<link rel"stylesheet" type="text/css" href="application.css">
<h1>Voting Record of <%= current_user.first_name %> <%= current_user.last_name %> </h1>
<table>
<thead>
<th>Voted Candidate</th>
<th>Position </th>
<th>Voted On</th>
</thead>
<tbody>
<% @votes.each do |o| %>
<tr>
<td><%= o.candidate.first_name %>&nbsp<%= o.candidate.last_name %></td>
<td><%= o.candidate.position.name %></td>
<td><%= o.created_at %></td>
</tr>
<% end %>
</tbody>
</table>
......@@ -14,20 +14,26 @@
<h4 style="color:#0080ff;margin-left:100px">
<% if user_signed_in? %>
Hello <%= current_user.email %>! <br>
<% if current_user.email == "norenceilicito@gmail.com" %>
Hello <a href = "/vote_history"> <%= current_user.first_name %></a>! <br>
<h4 style="margin-left:100px">
<%= link_to "Vote", vote_path %>&nbsp;&nbsp;
<%= link_to "Votes Record", vote_history_path %>&nbsp;&nbsp;
<%= link_to("Back to Home", root_path) %>&nbsp;&nbsp;
<%= link_to('Log Out', destroy_user_session_path, :method => :delete) %> &nbsp;&nbsp;
<%= link_to "Admin", admin_candidates_path %>
</h4>
<% else %>
Hello <a href = "/vote_history"> <%= current_user.first_name %></a>! <br>
<h4 style="margin-left:100px">
<%= link_to "Vote", vote_path %>&nbsp;&nbsp;
&nbsp;&nbsp;
<%= link_to('Log Out', destroy_user_session_path, :method => :delete) %></h4>
<% end %>
<% else %>
<h5 style="color:#0080ff;margin-left:100px">
You're not signed in.
<%= link_to "Login", new_user_session_path %>
<%= link_to "Register", new_user_registration_path %>
<%= link_to "Admin", admin_candidates_path %>
</h5>
<% end %>
......@@ -42,18 +48,17 @@
<th>Number of Votes</th>
</tr>
<% @candidates.each do |position_id, candidates| %>
<%= Position.find(position_id).name %>
<tr>
<% candidates.each do |candidate|%>
</tr>
<tr>
<td><%= candidate.position_id %></td>
<!--<td><%= candidate.position_id %></td>-->
<td><%= Position.find(position_id).name %>
<td><%= candidate.first_name %></td>
<td><%= candidate.last_name %></td>
<td><%= candidate.slogan %></td>
<td><%= candidate.votes.count %></td>
</tr>
<% end %>
<% end %>
......
......@@ -13,6 +13,7 @@
<%= o.button :submit, "Vote" %>
<% end %>
<%= link_to "Back", candidates_list_path %>
<%= link_to "Back to Home", candidates_list_path %>
<% end %>
<link rel"stylesheet" type="text/css" href="application.css">
<link rel"stylesheet" type="text/css" href="application.css">
<h1>Election 2016</h1>
<h3>Hello <%= current_user.first_name%> <%= current_user.last_name %>!</h3>
<ul>
<li> Email: <%= current_user.email %> </li>
<li> Birthday: <%= current_user.birthday %> </li>
<li> Sex: <%= current_user.gender %> </li>
<li> Password: <%= current_user.password %> </li>
</ul>
<h1>Voting Record of <%= current_user.first_name %> <%= current_user.last_name %> </h1>
<table>
......@@ -18,3 +36,5 @@
<% end %>
</tbody>
</table>
<%= link_to("Back to Home", root_path) %>
\ No newline at end of file
File mode changed from 100644 to 100755
......@@ -2,7 +2,7 @@ Rails.application.routes.draw do
devise_for :users
root to: "votes#index"
get "/profiles", to: "votes#vote_history"
get "/about", to: "pages#about"
get "/index", to: "pages#index"
resources :candidates
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
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