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
4d85676a
Commit
4d85676a
authored
Jul 20, 2016
by
Galen Evilla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added something
parent
e955b633
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
39 deletions
+31
-39
users_controller.rb
Halalan/app/controllers/users/users_controller.rb
+1
-1
index.html.erb
Halalan/app/views/admin/candidates/index.html.erb
+3
-4
index.html.erb
Halalan/app/views/admin/positions/index.html.erb
+7
-8
show.html.erb
Halalan/app/views/admin/positions/show.html.erb
+3
-2
index.html.erb
Halalan/app/views/pages/index.html.erb
+16
-23
routes.rb
Halalan/config/routes.rb
+1
-1
No files found.
Halalan/app/controllers/users/
profile
_controller.rb
→
Halalan/app/controllers/users/
users
_controller.rb
View file @
4d85676a
module
Users
class
Profile
Controller
<
ApplicationController
class
Users
Controller
<
ApplicationController
before_action
:authenticate_user!
def
index
@positions
=
Position
.
all
...
...
Halalan/app/views/admin/candidates/index.html.erb
View file @
4d85676a
...
...
@@ -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
%>
Halalan/app/views/admin/positions/index.html.erb
View file @
4d85676a
...
...
@@ -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
Halalan/app/views/admin/positions/show.html.erb
View file @
4d85676a
<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>
...
...
Halalan/app/views/pages/index.html.erb
View file @
4d85676a
...
...
@@ -13,27 +13,20 @@
<%
@positions
.
each
do
|
p
|
%>
<h4>
<%=
p
.
name
%>
</h4>
<table>
<thead>
<td>
</td>
<td>
Name
</td>
<td>
Slogan
</td>
<td>
Votes
</td>
<td>
</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
Halalan/config/routes.rb
View file @
4d85676a
...
...
@@ -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
...
...
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