Skip to content

Commit

Permalink
Allow voting for proposal till conference start date
Browse files Browse the repository at this point in the history
  • Loading branch information
Sijo Jose committed Dec 19, 2015
1 parent c3763de commit f3ee331
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 9 deletions.
8 changes: 6 additions & 2 deletions junction/proposals/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

# Standard Library
import collections
from datetime import datetime

# Third Party Stuff
from django.conf import settings
Expand Down Expand Up @@ -178,7 +179,7 @@ def detail_proposal(request, conference_slug, slug):
is_reviewer = _is_proposal_reviewer(request.user, conference)
is_section_reviewer = _is_proposal_section_reviewer(request.user, conference, proposal)
vote_value = 0

voting = True if conference.start_date > datetime.now().date() else False
try:
if request.user.is_authenticated():
proposal_vote = ProposalVote.objects.get(
Expand All @@ -196,7 +197,8 @@ def detail_proposal(request, conference_slug, slug):
'is_author': request.user == proposal.author,
'is_reviewer': is_reviewer,
'is_section_reviewer': is_section_reviewer,
'can_view_feedback': False
'can_view_feedback': False,
'can_vote':voting
}

if proposal.scheduleitem_set.all():
Expand Down Expand Up @@ -503,6 +505,8 @@ def create_proposal_comment(request, conference_slug, proposal_slug):
@login_required
def proposal_vote(request, conference_slug, proposal_slug, up_vote):
conference = get_object_or_404(Conference, slug=conference_slug)
if conference.start_date < datetime.now().date():
raise PermissionDenied
proposal = get_object_or_404(
Proposal, slug=proposal_slug, conference=conference)

Expand Down
26 changes: 19 additions & 7 deletions junction/templates/proposals/detail/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,33 @@ <h1 class="proposal-title">
</div>

<hr class="hr-mini">

<div class="row proposal-description">
<div class="col-sm-1 section--voting">
<div class="col-sm-1 section--voting ">
<div class="text-center">
<a href="#" data-url="{{ proposal.get_up_vote_url }}" class="btn-vote js-proposal-upvote text-muted {% if vote_value == 1 %} active {% endif %}">
{% if can_vote %}
<a href="#" data-url="{{ proposal.get_up_vote_url }}" class="btn-vote js-proposal-upvote text-muted {% if vote_value == 1 %} active {% endif %}">
<i class="fa fa-chevron-up fa-2x"></i>
</a>

</a>
{% else %}
<span class="text-muted {% if vote_value == 1 %} active btn-vote {% endif %}">
<i class="fa fa-chevron-up fa-2x"></i>
</span>
{% endif %}
<h1 class="clear-margin text-muted proposal-vote-count">
{{ proposal.get_votes_count }}
</h1>

<a href="#" data-url="{{ proposal.get_down_vote_url }}" class="btn-vote js-proposal-downvote text-muted {% if vote_value == -1 %} active {% endif %}">
{% if can_vote %}
<a href="#" data-url="{{ proposal.get_down_vote_url }}" class="btn-vote js-proposal-downvote text-muted {% if vote_value == -1 %} active {% endif %}">
<i class="fa fa-chevron-down fa-2x"></i>
</a>
</a>
{% else %}
<span class="text-muted {% if vote_value == -1 %} active btn-vote {% endif %}">
<i class="fa fa-chevron-down fa-2x"></i>
</span>
{% endif %}


</div>
</div>

Expand Down

0 comments on commit f3ee331

Please sign in to comment.