Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finalproject
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
AngKo_Catolico_Ilicito_Reyes
finalproject
Commits
fff69c85
Commit
fff69c85
authored
Jul 20, 2016
by
Jego Reyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ayos
parent
042519a4
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
126 additions
and
15 deletions
+126
-15
positions_controller.rb
election_2016/app/controllers/admin/positions_controller.rb
+52
-5
.DS_Store
election_2016/app/views/.DS_Store
+0
-0
.DS_Store
election_2016/app/views/admin/.DS_Store
+0
-0
index.html.erb
election_2016/app/views/admin/candidates/index.html.erb
+2
-2
show.html.erb
election_2016/app/views/admin/candidates/show.html.erb
+1
-1
_form.html.erb
election_2016/app/views/admin/positions/_form.html.erb
+7
-0
edit.html.erb
election_2016/app/views/admin/positions/edit.html.erb
+9
-0
index.html.erb
election_2016/app/views/admin/positions/index.html.erb
+34
-0
new.html.erb
election_2016/app/views/admin/positions/new.html.erb
+8
-0
show.html.erb
election_2016/app/views/admin/positions/show.html.erb
+11
-7
routes.rb
election_2016/config/routes.rb
+2
-0
No files found.
election_2016/app/controllers/admin/positions_controller.rb
View file @
fff69c85
module
Admin
class
PositionsController
<
ApplicationController
def
index
@positions
=
Position
.
all
render
"admin/positions/index.html.erb"
end
def
show
@position
=
Position
.
find
(
params
[
:id
])
@candidates
=
@position
.
candidates
render
"admin/positions/show.html.erb"
end
def
edit
@positions
=
Position
.
find
(
params
[
:id
])
end
def
update
@position
=
Positions
.
find
(
params
[
:id
])
if
@position
.
update
(
position_params
())
redirect_to
admin_position_path
(
@position
.
id
)
else
render
"admin/positions/edit.html.erb"
end
end
def
new
@position
=
Position
.
new
render
"admin/positions/new.html.erb"
end
def
create
@position
=
Position
.
new
(
position_params
())
if
@position
.
save
redirect_to
admin_position_path
(
@position
.
id
)
else
render
"admin/positions/new.html.erb"
end
end
def
show
@position
=
Position
.
find
(
params
[
:id
])
render
"admin/positions/show.html.erb"
end
def
destroy
@position
=
Position
.
find
(
params
[
:id
])
@position
.
destroy!
redirect_to
admin_positions_path
end
def
position_params
params
.
require
(
:position
).
permit!
end
end
end
\ No newline at end of file
election_2016/app/views/.DS_Store
View file @
fff69c85
No preview for this file type
election_2016/app/views/admin/.DS_Store
View file @
fff69c85
No preview for this file type
election_2016/app/views/admin/candidates/index.html.erb
View file @
fff69c85
...
...
@@ -7,8 +7,8 @@
<h2
style=
"margin-left:50px"
;
>
Candidates
</h2>
<h5>
<%=
link_to
"Add Candidate"
,
new_admin_candidate_path
%>
<h5
style=
"margin-left:50px"
;
>
<%=
link_to
"Add Candidate"
,
new_admin_candidate_path
%>
<h5
style=
"margin-left:50px"
;
>
<%=
link_to
"Add Position"
,
new_admin_position_path
%>
<hr>
...
...
election_2016/app/views/admin/candidates/show.html.erb
View file @
fff69c85
...
...
@@ -15,4 +15,4 @@
</h3>
<hr>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
\ No newline at end of file
<%=
link_to
"Back"
,
admin_candidates_path
%>
\ No newline at end of file
election_2016/app/views/admin/positions/_form.html.erb
0 → 100755
View file @
fff69c85
<link
rel
"
stylesheet
"
type=
"text/css"
href=
"application.css"
>
<%=
simple_form_for
([
:admin
,
@position
])
do
|
p
|
%>
<%=
p
.
input
:name
%>
<%=
p
.
submit
%>
<%
end
%>
election_2016/app/views/admin/positions/edit.html.erb
0 → 100755
View file @
fff69c85
<link
rel
"
stylesheet
"
type=
"text/css"
href=
"application.css"
>
<h1>
Edit Position/h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back"
,
admin_positions_path
%>
election_2016/app/views/admin/positions/index.html.erb
0 → 100755
View file @
fff69c85
<link
rel
"
stylesheet
"
type=
"text/css"
href=
"application.css"
>
<h1
style=
"font-family:'Droid Sans';margin-left:50px;margin-top:50px;"
>
Election 2016
</h1>
<h2
style=
"margin-left:50px"
;
>
Positions
</h2>
<h5
style=
"margin-left:50px"
;
>
<%=
link_to
"Add Position"
,
new_admin_position_path
%>
<hr>
<table
width=
"100%"
,
align=
"center"
>
<tr>
<th>
Position
</th>
</tr>
<%
@positions
.
each
do
|
a
|
%>
<tr>
<td>
<%=
a
.
name
%>
</td>
<td>
<%=
link_to
"Show"
,
admin_position_path
(
a
.
id
)
%>
<%=
link_to
"Edit"
,
edit_admin_position_path
(
a
.
id
)
%>
<%=
link_to
"Delete"
,
admin_position_path
(
a
.
id
),
method: :delete
,
data:
{
confirm:
'Are you sure?'
}
%>
</td>
</tr>
<%
end
%>
</table>
<br>
<h4
style=
"margin:100px;"
>
<%=
link_to
"Home"
,
root_path
%>
</h4>
election_2016/app/views/admin/positions/new.html.erb
0 → 100755
View file @
fff69c85
<link
rel
"
stylesheet
"
type=
"text/css"
href=
"application.css"
>
<h1>
New Position
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back"
,
admin_positions_path
%>
\ No newline at end of file
election_2016/app/views/admin/positions/show.html.erb
100644 → 100755
View file @
fff69c85
<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
<link
rel
"
stylesheet
"
type=
"text/css"
href=
"application.css"
>
<h1>
<%=
@position
.
name
%>
</h1>
<hr>
<%=
link_to
"Back"
,
admin_positions_path
%>
\ No newline at end of file
election_2016/config/routes.rb
View file @
fff69c85
...
...
@@ -6,6 +6,7 @@ Rails.application.routes.draw do
get
"/about"
,
to:
"pages#about"
get
"/index"
,
to:
"pages#index"
resources
:candidates
get
"/positions/:id"
,
to:
"positions#show"
get
'candidates_list'
,
to:
'votes#index'
,
as: :candidates_list
...
...
@@ -15,6 +16,7 @@ Rails.application.routes.draw do
namespace
:admin
do
resources
:candidates
resources
:positions
get
"/positions/:id"
,
to:
"positions#show"
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