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
25ece4ec
Commit
25ece4ec
authored
Jul 21, 2016
by
April Guian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kulang ng @
parent
2b896259
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
1 deletion
+79
-1
show.html.erb
Halalan-FINAL/app/views/admin/users/show.html.erb
+1
-1
Ind Task Notes
Halalan-FINAL/config/Ind Task Notes
+78
-0
No files found.
Halalan-FINAL/app/views/admin/users/show.html.erb
View file @
25ece4ec
...
...
@@ -16,7 +16,7 @@
<%
if
current_user
.
id
==
@user
.
id
%>
<h4>
<%=
link_to
"You haven't voted for any candidates yet. Vote Now!"
,
"/voting/votes"
%>
</h4>
<%
else
%>
<h4>
<%=
user
.
full_name
%>
has not casted their votes yet %>
</h4>
<h4>
<%=
@
user
.
full_name
%>
has not casted their votes yet %>
</h4>
<%
end
%>
</center>
<%
end
%>
...
...
Halalan-FINAL/config/Ind Task Notes
0 → 100644
View file @
25ece4ec
def vote
voted_for = false
@position = Position.find(params[:position_id])
#@candidate = params[:candidate_id]
#@pos = params[:id]
#@candidate = Candidate.new
#if current_user voted_for candidate.position
#Position.find(@position).candidates.each do |c|
# c.votes.each do |v|
# if current_user.id == v.user_id
# voted_for = true
# end
# end
#end
position.candidates.each do |c|
c.votes.each do |v|
if current_user.id == v.user_id
voted_for = true
end
end
end
#@post = Post.find(params[:post_id])
#@post.liked_by current_user
#respond_to do |format|
# format.html {redirect_to :back }
#end
#@position.voted_for current_user
if position.voted_for == false
# @vote = Vote.new
redirect_to new_voting_vote_path(@vote.id)
else
redirect_to admin_candidates_path
end
end
if position.voted_for == false
redirect_to new_voting_vote_path(@vote.id)
else
redirect_to admin_candidates_path, notice: "Sorry, you can only vote on a position and candidate once."
end
---------------
votes = Vote.all
voted_for = false
positions = Position.all
candidates = Candidate.all
@position = Position.find(params[:id])
candidates(@position).each do |c|
c.votes.each do |v|
if current_user.id == v.user_id
voted_for = true
end
end
end
if voted_for == false
#@votes= Vote.all
@candidate = Candidate.find(params[:id])
#@vote = Vote.new
redirect_to new_voting_vote_path(@candidate)
else
redirect_to admin_candidates_path
end
\ No newline at end of file
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