show offers on work page
parent
835ff4be8e
commit
b0f4eda221
|
@ -550,11 +550,15 @@ class Campaign(models.Model):
|
|||
|
||||
def effective_premiums(self):
|
||||
"""returns the available premiums for the Campaign including any default premiums"""
|
||||
if self.type is BUY2UNGLUE:
|
||||
return Premium.objects.none()
|
||||
q = Q(campaign=self) | Q(campaign__isnull=True)
|
||||
return Premium.objects.filter(q).exclude(type='XX').order_by('amount')
|
||||
|
||||
def custom_premiums(self):
|
||||
"""returns only the active custom premiums for the Campaign"""
|
||||
if self.type is BUY2UNGLUE:
|
||||
return Premium.objects.none()
|
||||
return Premium.objects.filter(campaign=self).filter(type='CU').order_by('amount')
|
||||
|
||||
@property
|
||||
|
|
|
@ -420,7 +420,7 @@ Please fix the following before launching your campaign:
|
|||
</ul>
|
||||
{% endif %}
|
||||
<h3>Acknowledgements</h3>
|
||||
<p>You can see who your biggest supporters are by looking at the <a href="{% url work_acks campaign.work.id %}">sample acknowledgement page</a>.
|
||||
<p>When you're logged in, the "Ungluers" tab on the <a href="{% url work work.id %}">campaign page</a> will tell you a bit about each ungluer- when they last pledged, for example, and you can send individual messages to each ungluer. Use this tool with care! You can see who your biggest supporters are by looking at the <a href="{% url work_acks campaign.work.id %}">sample acknowledgement page</a>.
|
||||
After your campaign succeeds, you can used this page to generate epub code for the acknowledgements section of your unglued ebook.
|
||||
</p>
|
||||
{% endif %}
|
||||
|
|
|
@ -422,11 +422,21 @@
|
|||
<div id="js-rightcol">
|
||||
<div class="clearfix">
|
||||
{% if status == 'ACTIVE' %}
|
||||
{% if work.last_campaign.type == 1 %}
|
||||
{% if pledged %}
|
||||
<div class="btn_support modify"><form action="{% url pledge_modify work_id %}" method="get"><input type="submit" value="Modify Pledge" /></form></div>
|
||||
{% else %}
|
||||
<div class="btn_support"><form action="{% url pledge work_id %}" method="get"><input type="submit" value="Pledge" /></form></div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if purchased %}
|
||||
<div class="btn_support">
|
||||
<a href="{% url download_purchased work_id %}" class="hijax"><span>Download</span></a>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="btn_support"><form action="{% url purchase work_id %}" method="get"><input type="submit" value="Purchase" /></form></div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if work.first_ebook %}
|
||||
<div class="btn_support">
|
||||
|
@ -469,8 +479,8 @@
|
|||
</div>
|
||||
</div>
|
||||
{% if status == 'ACTIVE' %}
|
||||
<div class="jsmodule">
|
||||
{% if premiums %}
|
||||
<div class="jsmodule">
|
||||
<a href="{% url pledge work_id %}"><h3 class="jsmod-title"><span>Premiums</span></h3></a>
|
||||
<div class="jsmod-content">
|
||||
<ul class="support menu">
|
||||
|
@ -499,9 +509,8 @@
|
|||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="jsmodule">
|
||||
{% ifequal work.last_campaign.type 1 %}
|
||||
<a href="{% url pledge work_id %}"><h3 class="jsmod-title"><span>Acknowledgements</span></h3></a>
|
||||
<div class="jsmod-content">
|
||||
In addition to any premiums you're eligible for, you'll automatically be acknowledged in the unglued ebook as follows:
|
||||
|
@ -561,6 +570,20 @@
|
|||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% else %}
|
||||
<a href="{% url purchase work_id %}"><h3 class="jsmod-title"><span>Purchase Options</span></h3></a>
|
||||
<div class="jsmod-content">
|
||||
<ul class="support menu">
|
||||
{% for offer in work.offers.all %}
|
||||
<li class="{% if forloop.first %}first{% else %}{% if forloop.last %}last{% endif %}{% endif %}">
|
||||
<a href="{% url purchase work_id %}?offer_id={{offer.id}}">
|
||||
<span class="menu-item-price">${{ offer.price|floatformat:0|intcomma }}</span>
|
||||
<span class="menu-item-desc">{{ offer.get_license_display }}</span>
|
||||
</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endifequal %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -13,6 +13,7 @@ from regluit.frontend.views import (
|
|||
GoodreadsDisplayView,
|
||||
LibraryThingView,
|
||||
PledgeView,
|
||||
PurchaseView,
|
||||
PledgeCompleteView,
|
||||
PledgeCancelView,
|
||||
PledgeRechargeView,
|
||||
|
@ -99,6 +100,8 @@ urlpatterns = patterns(
|
|||
url(r"^pledge/modify/(?P<work_id>\d+)$", login_required(PledgeView.as_view()), name="pledge_modify"),
|
||||
url(r"^pledge/fund/(?P<t_id>\d+)$", login_required(FundPledgeView.as_view()), name="fund_pledge"),
|
||||
url(r"^pledge/recharge/(?P<work_id>\d+)$", login_required(PledgeRechargeView.as_view()), name="pledge_recharge"),
|
||||
url(r"^purchase/(?P<work_id>\d+)/$", login_required(PurchaseView.as_view(),login_url='/accounts/login/purchase/'), name="purchase"),
|
||||
url(r"^purchase/(?P<work_id>\d+)/download/$", "download_purchased", name="download_purchased"),
|
||||
url(r"^donate_to_campaign/$", csrf_exempt(NonprofitCampaign.as_view()), name="nonprofit"),
|
||||
url(r"^subjects/$", "subjects", name="subjects"),
|
||||
url(r"^librarything/$", LibraryThingView.as_view(), name="librarything"),
|
||||
|
|
|
@ -938,7 +938,7 @@ class DonationView(TemplateView):
|
|||
context = {'user' : self.request.user,'nonprofit': settings.NONPROFIT}
|
||||
context['donate_form'] = DonateForm(initial={'username':self.request.user.username})
|
||||
return context
|
||||
|
||||
|
||||
class PledgeView(FormView):
|
||||
template_name="pledge.html"
|
||||
form_class = CampaignPledgeForm
|
||||
|
@ -1065,6 +1065,9 @@ class PledgeView(FormView):
|
|||
logger.error("Attempt to produce transaction id {0} failed".format(t.id))
|
||||
return HttpResponse("Our attempt to enable your transaction failed. We have logged this error.")
|
||||
|
||||
class PurchaseView(PledgeView):
|
||||
pass
|
||||
|
||||
class FundPledgeView(FormView):
|
||||
template_name="fund_the_pledge.html"
|
||||
form_class = CCForm
|
||||
|
@ -2443,7 +2446,7 @@ def lockss_manifest(request, year):
|
|||
ebooks = None
|
||||
|
||||
return render(request, "lockss_manifest.html", {'ebooks':ebooks, 'year': year})
|
||||
|
||||
|
||||
def download(request, work_id):
|
||||
context = {}
|
||||
work = safe_get_work(work_id)
|
||||
|
@ -2507,6 +2510,11 @@ def download(request, work_id):
|
|||
|
||||
return render(request, "download.html", context)
|
||||
|
||||
def download_purchased(request, work_id):
|
||||
if request.user.is_anonymous:
|
||||
HttpResponseRedirect('/accounts/login/download/')
|
||||
return download(request, work_id)
|
||||
|
||||
def about(request, facet):
|
||||
template = "about_" + facet + ".html"
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue