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
5fed7c3e
Commit
5fed7c3e
authored
Jul 20, 2016
by
Galen Evilla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added if else
parent
3a6e2d88
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
18 deletions
+47
-18
candidates_controller.rb
Halalan-FINAL/app/controllers/admin/candidates_controller.rb
+1
-0
positions_controller.rb
Halalan-FINAL/app/controllers/admin/positions_controller.rb
+2
-0
index.html.erb
Halalan-FINAL/app/views/admin/candidates/index.html.erb
+30
-13
show.html.erb
Halalan-FINAL/app/views/admin/positions/show.html.erb
+14
-5
No files found.
Halalan-FINAL/app/controllers/admin/candidates_controller.rb
View file @
5fed7c3e
...
...
@@ -2,6 +2,7 @@ module Admin
class
CandidatesController
<
ApplicationController
before_action
:authenticate_user!
def
index
@candidates
=
Candidate
.
all
@positions
=
Position
.
all
render
"admin/candidates/index.html.erb"
end
...
...
Halalan-FINAL/app/controllers/admin/positions_controller.rb
View file @
5fed7c3e
...
...
@@ -2,6 +2,7 @@ module Admin
class
PositionsController
<
ApplicationController
before_action
:authenticate_user!
def
index
@positions
=
Position
.
all
render
"admin/positions/index.html.erb"
end
...
...
@@ -42,6 +43,7 @@ module Admin
end
def
show
@candidates
=
Candidate
.
all
@position
=
Position
.
find
(
params
[
:id
])
render
"admin/positions/show.html.erb"
end
...
...
Halalan-FINAL/app/views/admin/candidates/index.html.erb
View file @
5fed7c3e
...
...
@@ -11,15 +11,19 @@
<div
class=
"col-md-12"
>
<left>
<h1>
Candidates
</h1>
<div
class=
"btn btn-info"
role =
"button"
>
<%=
link_to
"Add a Candidate"
,
new_admin_candidate_path
,
:method
=>
"get"
%>
</div>
</left>
<%
if
@positions
.
size
>
0
%>
<%
@positions
.
each
do
|
p
|
%>
<hr>
<h3><center>
<%=
p
.
name
%>
</center></h3>
<table>
<%
if
p
.
candidates
.
size
>
0
%>
<table
class=
"table table-hover"
>
<thead>
<th
width =
"40%"
><center>
Name
</center></th>
<th><center>
Slogan
</center></th>
</thead>
<%
p
.
candidates
.
each
do
|
c
|
%>
<tr>
<td>
...
...
@@ -27,12 +31,25 @@
<%=
link_to
c
.
full_name
,
admin_candidate_path
(
c
.
id
)
%>
</center>
</td>
<td>
<center>
<%=
c
.
slogan
%>
</center>
</td>
</tr>
<%
end
%>
<%
else
%>
<h4><center>
No created candidates.
</center></h4>
<%
end
%>
<center>
<div
class=
"btn btn-info"
role =
"button"
>
<%=
link_to
"Add a Candidate"
,
new_admin_candidate_path
,
:method
=>
"get"
%>
</div>
</center>
</table>
<%
end
%>
<%
else
%>
<h4>
No created candidates.
</h4>
<h4>
<center>
No created candidates.
</center>
</h4>
<%
end
%>
</div>
</div>
...
...
Halalan-FINAL/app/views/admin/positions/show.html.erb
View file @
5fed7c3e
...
...
@@ -26,11 +26,20 @@
<hr>
<h2>
Candidates for
<%=
@position
.
name
%>
</h2>
<%
if
@position
.
candidates
.
size
>
0
%>
<ul>
<%
@position
.
candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
full_name
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
<%
else
%>
<h4>
No Candidates for
<%=
@position
.
name
%>
</h4>
<div
class=
"btn btn-info"
role =
"button"
>
<%=
link_to
"Add a Candidate"
,
new_admin_candidate_path
,
:method
=>
"get"
%>
</div>
<br>
<%
end
%>
<br>
<%=
link_to
"Back to Positions"
,
admin_positions_path
%>
...
...
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