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
1eaf9d2d
Commit
1eaf9d2d
authored
Jul 18, 2016
by
Kristoff Sison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed wording inconsistencies
parent
8ef422dd
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
47 deletions
+27
-47
Gemfile.lock
Election/Gemfile.lock
+1
-1
candidates_controller.rb
Election/app/controllers/admin/candidates_controller.rb
+25
-25
candidates_controller.rb
Election/app/controllers/candidates_controller.rb
+1
-1
_form.html.erb
Election/app/views/admin/_form.html.erb
+0
-5
edit.html.erb
Election/app/views/admin/edit.html.erb
+0
-3
new.html.erb
Election/app/views/admin/new.html.erb
+0
-5
show.html.erb
Election/app/views/admin/show.html.erb
+0
-7
No files found.
Election/Gemfile.lock
View file @
1eaf9d2d
...
...
@@ -178,4 +178,4 @@ DEPENDENCIES
web-console (~> 2.0)
BUNDLED WITH
1.1
0.4
1.1
2.5
Election/app/controllers/admin/candidates_controller.rb
View file @
1eaf9d2d
...
...
@@ -8,20 +8,20 @@ class CandidatesController < ApplicationController
render
"admin/candidates/index.html.erb"
end
def
new
@
position
=
Candidate
.
new
@
candidate
=
Candidate
.
new
render
"admin/candidates/new.html.erb"
end
def
create
@candidate
=
Candidate
.
new
(
candidate_params
())
if
@
position
.
save
if
@
candidate
.
save
redirect_to
admin_candidate_path
(
@candidate
.
id
)
else
render
"admin/candidates/new.html.erb"
end
end
def
update
@candidate
=
Candidate
.
find
(
params
[
:id
])
def
update
@candidate
=
Candidate
.
find
(
params
[
:id
])
if
@candidate
.
update
(
candidate_params
())
redirect_to
admin_candidate_path
(
@candidate
.
id
)
...
...
@@ -29,30 +29,30 @@ class CandidatesController < ApplicationController
render
"admin/candidate/edit.html.erb"
end
end
def
show
@candidate
=
Candidate
.
find
(
params
[
:id
])
def
show
@candidate
=
Candidate
.
find
(
params
[
:id
])
@votes
=
Vote
.
where
(
candidate_id:
(
@candidate
.
id
))
@votes_male
=
Array
.
new
@votes_female
=
Array
.
new
@votes
.
each
do
|
vote
|
if
vote
.
user
.
gender
==
"Male"
@votes_male
.
push
(
vote
)
else
@votes_female
.
push
(
vote
)
end
@votes
=
Vote
.
where
(
candidate_id:
(
@candidate
.
id
))
@votes_male
=
Array
.
new
@votes_female
=
Array
.
new
@votes
.
each
do
|
vote
|
if
vote
.
user
.
gender
==
"Male"
@votes_male
.
push
(
vote
)
else
@votes_female
.
push
(
vote
)
end
end
end
def
destroy
@candidate
=
Candidate
.
find
(
params
[
:id
])
def
destroy
@candidate
=
Candidate
.
find
(
params
[
:id
])
@votes
=
Vote
.
where
(
candidate_id:
(
@candidate
.
id
))
@votes
.
destroy_all
@candidate
.
destroy
redirect_to
admin_candidates_path
end
def
candidate_params
params
.
require
(
:candidate
).
permit!
end
@votes
=
Vote
.
where
(
candidate_id:
(
@candidate
.
id
))
@votes
.
destroy_all
@candidate
.
destroy
redirect_to
admin_candidates_path
end
def
candidate_params
params
.
require
(
:candidate
).
permit!
end
end
end
\ No newline at end of file
Election/app/controllers/candidates_controller.rb
View file @
1eaf9d2d
class
CandidatesController
<
ApplicationController
def
index
@
positions
=
Position
.
all
@
candidates
=
Candidates
.
all
end
end
\ No newline at end of file
Election/app/views/admin/_form.html.erb
deleted
100644 → 0
View file @
8ef422dd
<%=
simple_form_for
([
:admin
,
@position
])
do
|
f
|
%>
<%=
f
.
input
:name
%>
<%=
f
.
submit
%>
<%
end
%>
\ No newline at end of file
Election/app/views/admin/edit.html.erb
deleted
100644 → 0
View file @
8ef422dd
<h1>
Admin Edit Position
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Positions"
,
admin_positions_path
%>
\ No newline at end of file
Election/app/views/admin/new.html.erb
deleted
100644 → 0
View file @
8ef422dd
<h1>
Admin New Position
</h1>
<%=
render
partial:
"form"
%>
<%=
link_to
"Back to Positions"
,
admin_positions_path
%>
Election/app/views/admin/show.html.erb
deleted
100644 → 0
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>
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