Merge pull request #375 from Gluejar/new_campaign_options
no contrib form if the ask is all zeropull/1/head
commit
edb769317d
|
@ -500,9 +500,6 @@ class Campaign(models.Model):
|
|||
self.problems.append(_('A buy-to-unglue campaign must have a target'))
|
||||
may_launch = False
|
||||
if self.type==THANKS:
|
||||
if self.work.offers.filter(price__gt=0,active=True).count()==0:
|
||||
self.problems.append(_('You can\'t launch a thanks-for-ungluing campaign without suggesting a contribution amount > 0' ))
|
||||
may_launch = False
|
||||
if EbookFile.objects.filter(edition__work=self.work).count()==0:
|
||||
self.problems.append(_('You can\'t launch a thanks-for-ungluing campaign if you don\'t have any ebook files uploaded' ))
|
||||
may_launch = False
|
||||
|
@ -809,6 +806,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;">
|
||||
|
|
|
@ -88,9 +88,6 @@ Please fix the following before launching your campaign:
|
|||
Total revenue: ${{ work.last_campaign.current_total|intcomma }} from {{ work.last_campaign.supporters_count }} Ungluers and {{ work.last_campaign.anon_count }} others
|
||||
{% endifequal %}
|
||||
</div>
|
||||
<div class="status">
|
||||
<img src="/static/images/images/icon-book-37by25-{{ work.percent_unglued }}.png" title="{{ work.percent_of_goal }}% of goal" alt="book list status" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -451,7 +448,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