no contrib form if the ask is all zero
parent
88b292afaf
commit
aa84366418
|
@ -809,6 +809,19 @@ class Campaign(models.Model):
|
|||
except Offer.DoesNotExist:
|
||||
return None
|
||||
|
||||
@property
|
||||
def ask_money(self):
|
||||
# true if there's an offer asking for money
|
||||
if self.type is REWARDS:
|
||||
return True
|
||||
try:
|
||||
Offer.objects.get(work=self.work, active=True, price__gt=0.00)
|
||||
return True
|
||||
except Offer.DoesNotExist:
|
||||
return False
|
||||
except Offer.MultipleObjectsReturned:
|
||||
return True
|
||||
|
||||
@property
|
||||
def days_per_copy(self):
|
||||
if self.individual_offer:
|
||||
|
|
|
@ -23,25 +23,32 @@ $j(document).ready(function() {
|
|||
<div id="lightbox_content">
|
||||
<span id="dropboxjs" data-app-key="{{ dropbox_key }}"></span>
|
||||
{% if show_beg %}
|
||||
<div class="border" style="padding: 10px; min-height: 18em">
|
||||
<div id="askblock">
|
||||
<div>Please help us thank the creators for making this book free. The amount is up to you.</div>
|
||||
<form class="askform" method="POST" action="{% url thank work.id %}#">
|
||||
{% csrf_token %}
|
||||
{{ form.non_field_errors }}
|
||||
<div class="contrib_amount">Amount: {{ form.preapproval_amount.errors }}${{ form.preapproval_amount }}</div>
|
||||
<div style="text-align: center;"><input name="pledge" type="submit" value="Say Thank You" id="contribsubmit" class="loader-gif" /></div>
|
||||
<div id="anoncontribbox"><I>{{ form.anonymous.label_tag }}</I> {{ form.anonymous.errors }}{{ form.anonymous }}</div>
|
||||
{% if request.user.credit.available > 0 %}
|
||||
<div > You have an available credit of ${{ request.user.credit.available|intcomma }} which will be applied to your contribution.</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% if work.last_campaign.ask_money %}
|
||||
<div class="border" style="padding: 10px; min-height: 18em">
|
||||
<div id="askblock">
|
||||
<div>Please help us thank the creators for making this book free. The amount is up to you.</div>
|
||||
<form class="askform" method="POST" action="{% url thank work.id %}#">
|
||||
{% csrf_token %}
|
||||
{{ form.non_field_errors }}
|
||||
<div class="contrib_amount">Amount: {{ form.preapproval_amount.errors }}${{ form.preapproval_amount }}</div>
|
||||
<div style="text-align: center;"><input name="pledge" type="submit" value="Say Thank You" id="contribsubmit" class="loader-gif" /></div>
|
||||
<div id="anoncontribbox"><I>{{ form.anonymous.label_tag }}</I> {{ form.anonymous.errors }}{{ form.anonymous }}</div>
|
||||
{% if request.user.credit.available > 0 %}
|
||||
<div > You have an available credit of ${{ request.user.credit.available|intcomma }} which will be applied to your contribution.</div>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
<div class="rh_ask">
|
||||
{{ work.last_campaign.description|safe }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="rh_ask">
|
||||
{{ work.last_campaign.description|safe }}
|
||||
{% else %}
|
||||
<div class="border" style="padding: 10px">
|
||||
<div class="rh_ask">
|
||||
{{ work.last_campaign.description|safe }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if user_license.thanked %}
|
||||
<div style="text-align: center; padding: 20px;">
|
||||
|
|
|
@ -451,7 +451,7 @@ Please fix the following before launching your campaign:
|
|||
{% if not campaign.work.ebookfiles.0 %}
|
||||
<p> <b>ebook files for this work <a class="tabs1">need to be loaded</a>!</b></p>
|
||||
{% endif %}
|
||||
<p> Enter a suggested per/copy contribution for each user type. You may change these numbers after the campaign has begun. Don't suggest contributions between $0.00 and $1.00, because these won't be processed.</p>
|
||||
<p> Enter a suggested per/copy contribution for each user type. You may change these numbers after the campaign has begun. Don't suggest contributions between $0.00 and $1.00, because these won't be processed. If you enter $0 for BOTH, then no contribution form will be displayed.</p>
|
||||
<div class="jsmod-content">
|
||||
{% for offer in offers %}
|
||||
<form action="#" method="POST"><div>
|
||||
|
|
|
@ -690,6 +690,7 @@
|
|||
<span class="menu-item-desc">You're welcome!</span>
|
||||
</li>
|
||||
{% else %}
|
||||
{% if work.last_campaign.ask_money %}
|
||||
<li class="first last" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
|
||||
{% if request.user.library %}
|
||||
<a href="{% url thank work_id %}?offer_id={{work.last_campaign.library_offer.id}}">
|
||||
|
@ -703,6 +704,12 @@
|
|||
</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li class="first last" >
|
||||
<a href="{% url download work_id %}">
|
||||
<span class="menu-item-desc">Just read the book!</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue