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
f07015a9
Commit
f07015a9
authored
Jul 20, 2016
by
Kristoff Sison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added voting based on cadidate id
parent
5e8443b6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
election_controller.rb
Election/app/controllers/election_controller.rb
+9
-0
show.html.erb
Election/app/views/admin/candidates/show.html.erb
+1
-0
routes.rb
Election/config/routes.rb
+1
-0
No files found.
Election/app/controllers/election_controller.rb
0 → 100644
View file @
f07015a9
class
ElectionController
<
ApplicationController
def
vote
if
Vote
.
exists?
(
candidate_id:
params
[
:id
],
user_id:
current_user
.
id
)
render
"candidates/show.html.erb"
else
redirect_to
new_vote_path
end
end
end
\ No newline at end of file
Election/app/views/admin/candidates/show.html.erb
View file @
f07015a9
...
@@ -7,4 +7,5 @@
...
@@ -7,4 +7,5 @@
<li>
Female Voters:
<%=
@votes_female
.
size
%>
</li>
<li>
Female Voters:
<%=
@votes_female
.
size
%>
</li>
</ul>
</ul>
<%=
link_to
"Votes for Candidate"
,
"/election/vote/
#{
@candidate
.
id
}
"
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
<%=
link_to
"Back to Candidates"
,
admin_candidates_path
%>
\ No newline at end of file
Election/config/routes.rb
View file @
f07015a9
...
@@ -16,6 +16,7 @@ Rails.application.routes.draw do
...
@@ -16,6 +16,7 @@ Rails.application.routes.draw do
get
'/party_lists/index'
,
to:
"party_lists#index"
get
'/party_lists/index'
,
to:
"party_lists#index"
get
'/votes/user_profile'
,
to:
"votes#profile"
get
'/votes/user_profile'
,
to:
"votes#profile"
get
'/votes/index'
,
to:
"votes#index"
get
'/votes/index'
,
to:
"votes#index"
get
'/election/vote/:id'
,
to:
"election#vote"
post
'/checkout'
,
to:
'votes#checkout'
,
as: :checkout
post
'/checkout'
,
to:
'votes#checkout'
,
as: :checkout
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