Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MIS21FinalsElection
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
Dean Krisitan Bardeloza
MIS21FinalsElection
Commits
8ef422dd
Commit
8ef422dd
authored
Jul 18, 2016
by
Alfonso Gabriel R. Arvisu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a candidates page under views\admin\candidates and edited the layout
parent
932a32f9
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
4 deletions
+54
-4
candidates_controller.rb
Election/app/controllers/admin/candidates_controller.rb
+1
-1
positions_controller.rb
Election/app/controllers/positions_controller.rb
+1
-1
_form.html.erb
Election/app/views/admin/candidates/_form.html.erb
+7
-0
edit.html.erb
Election/app/views/admin/candidates/edit.html.erb
+5
-0
index.html.erb
Election/app/views/admin/candidates/index.html.erb
+27
-0
new.html.erb
Election/app/views/admin/candidates/new.html.erb
+5
-0
show.html.erb
Election/app/views/admin/candidates/show.html.erb
+7
-0
index.html.erb
Election/app/views/admin/positions/index.html.erb
+0
-1
application.html.erb
Election/app/views/layouts/application.html.erb
+1
-1
No files found.
Election/app/controllers/admin/candidates_controller.rb
View file @
8ef422dd
...
@@ -4,7 +4,7 @@ class CandidatesController < ApplicationController
...
@@ -4,7 +4,7 @@ class CandidatesController < ApplicationController
def
index
def
index
@candidates
=
Candidate
.
all
@candidates
=
Candidate
.
all
@positions
=
Postion
.
all
@positions
=
Pos
i
tion
.
all
render
"admin/candidates/index.html.erb"
render
"admin/candidates/index.html.erb"
end
end
def
new
def
new
...
...
Election/app/controllers/positions_controller.rb
View file @
8ef422dd
...
@@ -3,7 +3,7 @@ class PositionsController < ApplicationController
...
@@ -3,7 +3,7 @@ class PositionsController < ApplicationController
def
show
def
show
@position
=
Position
.
find
(
params
[
:id
])
@position
=
Position
.
find
(
params
[
:id
])
@candidates
=
@candidate
.
positions
@candidates
=
@candidate
.
positions
render
"
categorie
s/show.html.erb"
render
"
position
s/show.html.erb"
end
end
end
end
\ No newline at end of file
Election/app/views/admin/candidates/_form.html.erb
0 → 100644
View file @
8ef422dd
<%=
simple_form_for
([
:admin
,
@candidate
])
do
|
f
|
%>
<%=
f
.
input
:first_name
%>
<%=
f
.
input
:last_name
%>
<%=
f
.
input
:nickname
%>
<%=
f
.
input
:slogan
%>
<%=
f
.
submit
%>
<%
end
%>
\ No newline at end of file
Election/app/views/admin/candidates/edit.html.erb
0 → 100644
View file @
8ef422dd
<h1>
Admin New Candidate
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
Election/app/views/admin/candidates/index.html.erb
0 → 100644
View file @
8ef422dd
<h1>
Admin Candidates
</h1>
<hr>
<%=
link_to
(
"New Candidate"
,
new_admin_candidate_path
)
%>
<hr>
<table
width=
"100%"
>
<tr>
<th>
First Name
</th>
<th>
Last Name
</th>
<th>
Nickname
</th>
<th>
Slogan
</th>
<th>
Actions
</th>
</tr>
<%
@candidates
.
each
do
|
candidate
|
%>
<tr>
<td>
<%=
candidate
.
first_name
%>
</td>
<td>
<%=
candidate
.
last_name
%>
</td>
<td>
<%=
candidate
.
nickname
%>
</td>
<td>
<%=
candidate
.
slogan
%>
</td>
<td>
<%=
link_to
"Show"
,
admin_candidate_path
(
candidate
.
id
)
%>
<%=
link_to
"Edit"
,
edit_admin_candidate_path
(
candidate
.
id
)
%>
<%=
link_to
"Delete"
,
admin_candidate_path
(
candidate
.
id
),
method: :delete
,
data:
{
confirm:
'Are you sure?'
}
%>
</td>
</tr>
<%
end
%>
</table>
Election/app/views/admin/candidates/new.html.erb
0 → 100644
View file @
8ef422dd
<h1>
Admin New Candidate
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
Election/app/views/admin/candidates/show.html.erb
0 → 100644
View file @
8ef422dd
<h1>
Position:
<%=
@position
.
name
%>
</h1>
<h2>
Candidates:
</h2>
<ul>
<%
@candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
"
#{
c
.
first_name
}
"
+
"
#{
c
.
last_name
}
"
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
Election/app/views/admin/positions/index.html.erb
View file @
8ef422dd
...
@@ -18,4 +18,3 @@
...
@@ -18,4 +18,3 @@
<%
end
%>
<%
end
%>
</table>
</table>
<hr>
<hr>
<%=
link_to
"Back to Homepage"
,
root_path
%>
\ No newline at end of file
Election/app/views/layouts/application.html.erb
View file @
8ef422dd
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
<body>
<body>
<%
if
user_signed_in?
%>
<%
if
user_signed_in?
%>
<
p>
You are logged in as
<%=
current_user
.
email
%>
.
</p>
<%=
link_to
"Log Out"
,
destroy_user_session_path
,
method: :delete
%>
||
<
%=
"You are logged in as:
#{
current_user
.
email
}
"
%>
<%=
link_to
"Log Out"
,
destroy_user_session_path
,
method: :delete
%>
||
<%
else
%>
<%
else
%>
<%=
""
%>
<%=
""
%>
<%
end
%>
<%
end
%>
...
...
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