Permalink
Browse files

Allow voting for proposal till conference start date

  • Loading branch information...
Sijo Jose
Sijo Jose committed Dec 19, 2015
1 parent c3763de commit f3ee331396e480bf2a1905a15ed3636deea882ca
Showing with 25 additions and 9 deletions.
  1. +6 −2 junction/proposals/views.py
  2. +19 −7 junction/templates/proposals/detail/base.html
@@ -3,6 +3,7 @@
# Standard Library
import collections
from datetime import datetime
# Third Party Stuff
from django.conf import settings
@@ -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(
@@ -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():
@@ -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)
@@ -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>

0 comments on commit f3ee331

Please sign in to comment.