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
38b7caef
Commit
38b7caef
authored
Jul 16, 2016
by
April Guian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Draft2
parent
7d1aec14
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
183 additions
and
4 deletions
+183
-4
pages_controller.rb
mock_elections/app/controllers/pages_controller.rb
+9
-0
_form.html.erb
mock_elections/app/views/admin/candidates/_form.html.erb
+7
-0
edit.html.erb
mock_elections/app/views/admin/candidates/edit.html.erb
+13
-0
index.html.erb
mock_elections/app/views/admin/candidates/index.html.erb
+2
-0
new.html.erb
mock_elections/app/views/admin/candidates/new.html.erb
+5
-0
show.html.erb
mock_elections/app/views/admin/candidates/show.html.erb
+7
-0
_form.html.erb
mock_elections/app/views/admin/position/_form.html.erb
+4
-0
edit.html.erb
mock_elections/app/views/admin/position/edit.html.erb
+13
-0
index.html.erb
mock_elections/app/views/admin/position/index.html.erb
+14
-0
new.html.erb
mock_elections/app/views/admin/position/new.html.erb
+5
-0
show.html.erb
mock_elections/app/views/admin/position/show.html.erb
+7
-0
_form.html.erb
mock_elections/app/views/candidates/_form.html.erb
+7
-0
edit.html.erb
mock_elections/app/views/candidates/edit.html.erb
+13
-0
index.html.erb
mock_elections/app/views/candidates/index.html.erb
+2
-0
new.html.erb
mock_elections/app/views/candidates/new.html.erb
+5
-0
show.html.erb
mock_elections/app/views/candidates/show.html.erb
+7
-0
index.html.erb
mock_elections/app/views/pages/index.html.erb
+16
-0
_form.html.erb
mock_elections/app/views/position/_form.html.erb
+4
-0
edit.html.erb
mock_elections/app/views/position/edit.html.erb
+13
-0
index.html.erb
mock_elections/app/views/position/index.html.erb
+14
-0
new.html.erb
mock_elections/app/views/position/new.html.erb
+5
-0
show.html.erb
mock_elections/app/views/position/show.html.erb
+7
-0
routes.rb
mock_elections/config/routes.rb
+4
-4
No files found.
mock_elections/app/controllers/pages_controller.rb
View file @
38b7caef
class
PagesController
<
ApplicationController
def
index
@candidates
=
Candidate
.
all
@positions
=
Position
.
all
@users
=
User
.
all
@votes
=
Vote
.
all
render
"pages/index.html.erb"
end
end
\ No newline at end of file
mock_elections/app/views/admin/candidates/_form.html.erb
0 → 100644
View file @
38b7caef
<%=
simple_form_for
([
:admin
,
@candidate
])
do
|
f
|
%>
<%=
f
.
input
:first_name
%>
<%=
f
.
input
:last_name
%>
<%=
f
.
input
:slogan
%>
<%=
f
.
input
:position_id
%>
<%=
f
.
submit
%>
<%
end
%>
mock_elections/app/views/admin/candidates/edit.html.erb
0 → 100644
View file @
38b7caef
<h1>
Edit Candidate
</h1>
<%
if
admin_signed_in?
%>
Hello Admin!
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List of Positions"
,
admin_candidates_path
%>
<%
else
%>
You are not signed in. Please go to login page.
<%
end
%>
\ No newline at end of file
mock_elections/app/views/admin/candidates/index.html.erb
0 → 100644
View file @
38b7caef
<h1>
2016 Election Candidates
</h1>
mock_elections/app/views/admin/candidates/new.html.erb
0 → 100644
View file @
38b7caef
<h1>
Add New Candidate
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List of Candidates"
,
admin_candidates_path
%>
\ No newline at end of file
mock_elections/app/views/admin/candidates/show.html.erb
0 → 100644
View file @
38b7caef
<h1>
Position:
<%=
@position
.
name
%>
</h1>
<h2>
Candidates:
</h2>
<ul>
<%
@candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
last_name
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
\ No newline at end of file
mock_elections/app/views/admin/position/_form.html.erb
0 → 100644
View file @
38b7caef
<%=
simple_form_for
([
:admin
,
@position
])
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
submit
%>
<%
end
%>
mock_elections/app/views/admin/position/edit.html.erb
0 → 100644
View file @
38b7caef
<h1>
Edit Position
</h1>
<%
if
admin_signed_in?
%>
Hello Admin!
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List of Positions"
,
admin_positions_path
%>
<%
else
%>
You are not signed in. Please go to login page.
<%
end
%>
\ No newline at end of file
mock_elections/app/views/admin/position/index.html.erb
0 → 100644
View file @
38b7caef
<h1>
2016 Election
</h1>
<table
width=
"100%"
>
<tr>
<th>
Position
</th>
</tr>
<%
@positions
.
each
do
|
p
|
%>
<tr>
<td>
<%=
p
.
name
%>
</td>
<td>
<%=
link_to
"Show Candidates"
,
admin_positions_path
(
positions
.
id
)
%>
</td>
</tr>
<%
end
%>
</table>
mock_elections/app/views/admin/position/new.html.erb
0 → 100644
View file @
38b7caef
<h1>
Add New Position
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List"
,
admin_positions_path
%>
\ No newline at end of file
mock_elections/app/views/admin/position/show.html.erb
0 → 100644
View file @
38b7caef
<h1>
Position:
<%=
@position
.
name
%>
</h1>
<h2>
Candidates:
</h2>
<ul>
<%
@candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
last_name
,
admin_candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
\ No newline at end of file
mock_elections/app/views/candidates/_form.html.erb
0 → 100644
View file @
38b7caef
<%=
simple_form_for
(
@candidate
)
do
|
f
|
%>
<%=
f
.
input
:first_name
%>
<%=
f
.
input
:last_name
%>
<%=
f
.
input
:slogan
%>
<%=
f
.
input
:position_id
%>
<%=
f
.
submit
%>
<%
end
%>
mock_elections/app/views/candidates/edit.html.erb
0 → 100644
View file @
38b7caef
<h1>
Edit Candidate
</h1>
<%
if
admin_signed_in?
%>
Hello Admin!
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List of Positions"
,
admin_candidates_path
%>
<%
else
%>
You are not signed in. Please go to login page.
<%
end
%>
\ No newline at end of file
mock_elections/app/views/candidates/index.html.erb
0 → 100644
View file @
38b7caef
<h1>
2016 Election Candidates
</h1>
mock_elections/app/views/candidates/new.html.erb
0 → 100644
View file @
38b7caef
<h1>
Add New Candidate
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List of Candidates"
,
candidates_path
%>
\ No newline at end of file
mock_elections/app/views/candidates/show.html.erb
0 → 100644
View file @
38b7caef
<h1>
Position:
<%=
@position
.
name
%>
</h1>
<h2>
Candidates:
</h2>
<ul>
<%
@candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
last_name
,
candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
\ No newline at end of file
mock_elections/app/views/pages/index.html.erb
0 → 100644
View file @
38b7caef
<h1>
Mock Elections 2016
</h1>
<%=
link_to
"Manage Positions Under Admin"
,
admin_positions_path
%>
<%=
link_to
"Manage Candidates Under Admin"
,
admin_candidates_path
%>
<hr>
<%
@positions
.
each
do
|
p
|
%>
<h2>
(
<%=
p
.
id
%>
)
<%=
p
.
name
%>
</h2>
<ul>
<%
p
.
candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
title
,
post_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
<%=
link_to
"View all Candidates"
,
"/positions/
#{
p
.
id
}
"
%>
<%
end
%>
\ No newline at end of file
mock_elections/app/views/position/_form.html.erb
0 → 100644
View file @
38b7caef
<%=
simple_form_for
(
@position
)
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
submit
%>
<%
end
%>
mock_elections/app/views/position/edit.html.erb
0 → 100644
View file @
38b7caef
<h1>
Edit Position
</h1>
<%
if
admin_signed_in?
%>
Hello User!
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List of Positions"
,
admin_posts_path
%>
<%
else
%>
You are not signed in. Please go to login page.
<%
end
%>
\ No newline at end of file
mock_elections/app/views/position/index.html.erb
0 → 100644
View file @
38b7caef
<h1>
2016 Election
</h1>
<table
width=
"100%"
>
<tr>
<th>
Position
</th>
</tr>
<%
@positions
.
each
do
|
p
|
%>
<tr>
<td>
<%=
p
.
name
%>
</td>
<td>
<%=
link_to
"Show Candidates"
,
positions_path
(
positions
.
id
)
%>
</td>
</tr>
<%
end
%>
</table>
mock_elections/app/views/position/new.html.erb
0 → 100644
View file @
38b7caef
<h1>
Add New Position
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to List"
,
positions_path
%>
\ No newline at end of file
mock_elections/app/views/position/show.html.erb
0 → 100644
View file @
38b7caef
<h1>
Position:
<%=
@position
.
name
%>
</h1>
<h2>
Candidates:
</h2>
<ul>
<%
@candidates
.
each
do
|
c
|
%>
<li>
<%=
link_to
c
.
last_name
,
candidate_path
(
c
.
id
)
%>
</li>
<%
end
%>
</ul>
\ No newline at end of file
mock_elections/config/routes.rb
View file @
38b7caef
Rails
.
application
.
routes
.
draw
do
devise_for
:users
root
to:
"pages#index"
#resource
s
resources
:candidates
,
:position
s
#
namespace :admin do
# resources :post
s
#
end
namespace
:admin
do
resources
:candidates
,
:position
s
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