Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
final_project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
evilla_gomez_guian_principe
final_project
Commits
c172c99b
Commit
c172c99b
authored
Jul 20, 2016
by
Wills Gomez
Browse files
Options
Browse Files
Download
Plain Diff
fixed nav bar and other page changes
parents
e296d3d4
2920b041
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
120 additions
and
49 deletions
+120
-49
pages_controller.rb
Halalan/app/controllers/pages_controller.rb
+1
-0
users_controller.rb
Halalan/app/controllers/users/users_controller.rb
+7
-7
edit.html.erb
Halalan/app/views/admin/candidates/edit.html.erb
+4
-1
index.html.erb
Halalan/app/views/admin/candidates/index.html.erb
+25
-9
new.html.erb
Halalan/app/views/admin/candidates/new.html.erb
+3
-0
show.html.erb
Halalan/app/views/admin/candidates/show.html.erb
+16
-6
edit.html.erb
Halalan/app/views/admin/positions/edit.html.erb
+4
-1
index.html.erb
Halalan/app/views/admin/positions/index.html.erb
+14
-8
new.html.erb
Halalan/app/views/admin/positions/new.html.erb
+3
-0
show.html.erb
Halalan/app/views/admin/positions/show.html.erb
+3
-0
edit.html.erb
Halalan/app/views/devise/registrations/edit.html.erb
+1
-1
new.html.erb
Halalan/app/views/devise/registrations/new.html.erb
+1
-1
_navbar.html.erb
Halalan/app/views/layouts/_navbar.html.erb
+8
-0
application.html.erb
Halalan/app/views/layouts/application.html.erb
+1
-1
index.html.erb
Halalan/app/views/pages/index.html.erb
+22
-0
edit.html.erb
Halalan/app/views/voting/votes/edit.html.erb
+0
-5
index.html.erb
Halalan/app/views/voting/votes/index.html.erb
+3
-0
new.html.erb
Halalan/app/views/voting/votes/new.html.erb
+3
-0
show.html.erb
Halalan/app/views/voting/votes/show.html.erb
+0
-8
routes.rb
Halalan/config/routes.rb
+1
-1
No files found.
Halalan/app/controllers/pages_controller.rb
View file @
c172c99b
class
PagesController
<
ApplicationController
def
index
@users
=
User
.
all
@votes
=
Vote
.
all
@candidates
=
Candidate
.
all
@positions
=
Position
.
all
...
...
Halalan/app/controllers/users/users_controller.rb
View file @
c172c99b
module
Users
class
UsersController
<
ApplicationController
before_action
:authenticate_user!
def
index
@positions
=
Position
.
all
@candidates
=
Candidate
.
all
@votes
=
Vote
.
all
render
"pages/profile.html.erb"
end
before_action
:authenticate_user!
def
index
@positions
=
Position
.
all
@candidates
=
Candidate
.
all
@votes
=
Vote
.
all
render
"pages/profile.html.erb"
end
end
end
Halalan/app/views/admin/candidates/edit.html.erb
View file @
c172c99b
<h1>
Admin Edit Post
</h1>
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:title
,
"Edit Candidate"
)
%>
<h1>
Edit Candidate's Information
</h1>
<%=
render
partial:
"form"
%>
...
...
Halalan/app/views/admin/candidates/index.html.erb
View file @
c172c99b
<%
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>
</center></th>
<th><center>
Name
</center></th>
<th><center>
Slogan
</center></th>
<th><center>
</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
%>
Halalan/app/views/admin/candidates/new.html.erb
View file @
c172c99b
<%
provide
(
:candidate
,
"active"
)
%>
<%
provide
(
:title
,
"New Candidate"
)
%>
<h1>
New Candidate
</h1>
<%=
render
partial:
"form"
%>
...
...
Halalan/app/views/admin/candidates/show.html.erb
View file @
c172c99b
<
<<<<<<
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>
...
...
Halalan/app/views/admin/positions/edit.html.erb
View file @
c172c99b
<h1>
Admin Edit Post
</h1>
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"Edit Position"
)
%>
<h1>
Edit Position
</h1>
<%=
render
partial:
"form"
%>
...
...
Halalan/app/views/admin/positions/index.html.erb
View file @
c172c99b
<
<<<<<<
HEAD
<
h1
><center>
POSITIONS
</center></h1>
<center>
<%=
link_to
"Add New Position"
,
new_admin_position_path
%>
</center>
=======
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"Positions"
)
%>
<hr>
<h1>
Positions
</h1>
>>>>>>> 2920b0418adc40c16be842ad29c33a2aefaa3052
<%
@positions
.
each
do
|
c
|
%>
<h2>
<%=
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>
<hr>
<%
@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
Halalan/app/views/admin/positions/new.html.erb
View file @
c172c99b
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"New Position"
)
%>
<h1>
New Position
</h1>
<%=
render
partial:
"form"
%>
...
...
Halalan/app/views/admin/positions/show.html.erb
View file @
c172c99b
<%
provide
(
:position
,
"active"
)
%>
<%
provide
(
:title
,
"
#{
@position
.
name
}
"
)
%>
<h1>
<%=
@position
.
name
%>
</h1>
<%=
link_to
"Edit"
,
edit_admin_position_path
(
@position
.
id
)
%>
...
...
Halalan/app/views/devise/registrations/edit.html.erb
View file @
c172c99b
...
...
@@ -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?
%>
...
...
Halalan/app/views/devise/registrations/new.html.erb
View file @
c172c99b
...
...
@@ -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
%>
...
...
Halalan/app/views/layouts/_navbar.html.erb
View file @
c172c99b
...
...
@@ -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"
>
...
...
Halalan/app/views/layouts/application.html.erb
View file @
c172c99b
<!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
%>
...
...
Halalan/app/views/pages/index.html.erb
View file @
c172c99b
<
<<<<<<
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>
...
...
Halalan/app/views/voting/votes/edit.html.erb
deleted
100644 → 0
View file @
e296d3d4
<h1>
Admin Edit Post
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Posts"
,
admin_posts_path
%>
\ No newline at end of file
Halalan/app/views/voting/votes/index.html.erb
View file @
c172c99b
<%
provide
(
:vote
,
"active"
)
%>
<%
provide
(
:title
,
"Vote now!"
)
%>
<h1><center>
VOTES
</center></h1>
...
...
Halalan/app/views/voting/votes/new.html.erb
View file @
c172c99b
<%
provide
(
:vote
,
"active"
)
%>
<%
provide
(
:title
,
"Vote"
)
%>
<h1>
Vote
</h1>
<%=
render
partial:
"form"
%>
...
...
Halalan/app/views/voting/votes/show.html.erb
deleted
100644 → 0
View file @
e296d3d4
<h1>
<%=
@post
.
title
%>
</h1>
<h3>
<%=
@post
.
published_at
%>
</h3>
<p>
<%=
@post
.
content
%>
</p>
<hr>
<%=
link_to
"Back to Posts"
,
admin_posts_path
%>
Halalan/config/routes.rb
View file @
c172c99b
...
...
@@ -5,7 +5,7 @@ Rails.application.routes.draw do
resources
:users
get
"/profile"
,
to:
"users/users#index"
get
"/profile"
,
to:
"users/users#index"
get
"/voting/new/:id"
,
to:
"voting/votes#new"
get
"/about"
=>
"pages#about"
,
as: :about
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment