[finish #30516251] supporter acknowledgement page basic version
parent
21e3cb582d
commit
e2962e1075
|
@ -90,6 +90,7 @@ class RightsHolder(models.Model):
|
|||
|
||||
class Premium(models.Model):
|
||||
PREMIUM_TYPES = ((u'00', u'Default'),(u'CU', u'Custom'),(u'XX', u'Inactive'))
|
||||
TIERS = {"supporter":25, "patron":50, "bibliophile":100} #should load this from fixture
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
type = models.CharField(max_length=2, choices=PREMIUM_TYPES)
|
||||
campaign = models.ForeignKey("Campaign", related_name="premiums", null=True)
|
||||
|
@ -105,6 +106,7 @@ class Premium(models.Model):
|
|||
def premium_remaining(self):
|
||||
t_model=get_model('payment','Transaction')
|
||||
return self.limit - t_model.objects.filter(premium=self).count()
|
||||
|
||||
|
||||
class CampaignAction(models.Model):
|
||||
timestamp = models.DateTimeField(auto_now_add=True)
|
||||
|
@ -321,6 +323,27 @@ class Campaign(models.Model):
|
|||
def supporters_count(self):
|
||||
# avoid transmitting the whole list if you don't need to; let the db do the count.
|
||||
return self.transactions().filter(status=TRANSACTION_STATUS_ACTIVE).values_list('user', flat=True).distinct().count()
|
||||
|
||||
def ungluers(self):
|
||||
p = PaymentManager()
|
||||
ungluers={"all":[],"supporters":[], "patrons":[], "bibliophiles":[]}
|
||||
if self.status == "ACTIVE":
|
||||
translist = p.query_campaign(self, summary=False, pledged=True, authorized=True)
|
||||
elif self.status == "SUCCESSFUL":
|
||||
translist = p.query_campaign(self, summary=False, pledged=True, completed=True)
|
||||
else:
|
||||
translist = []
|
||||
for transaction in translist:
|
||||
ungluers['all'].append(transaction.user)
|
||||
if not transaction.anonymous:
|
||||
if transaction.amount >= Premium.TIERS["bibliophile"]:
|
||||
ungluers['bibliophiles'].append(transaction.user)
|
||||
elif transaction.amount >= Premium.TIERS["patron"]:
|
||||
ungluers['patrons'].append(transaction.user)
|
||||
elif transaction.amount >= Premium.TIERS["supporter"]:
|
||||
ungluers['supporters'].append(transaction.user)
|
||||
|
||||
return ungluers
|
||||
|
||||
def effective_premiums(self):
|
||||
"""returns the available premiums for the Campaign including any default premiums"""
|
||||
|
|
|
@ -1,7 +1,14 @@
|
|||
{% extends "basedocumentation.html" %}
|
||||
{% block title %}Open Access eBooks{% endblock %}
|
||||
{% block extra_extra_head %}
|
||||
<link rel="stylesheet" type="text/css" href="/static/css/vanilla.css" class="day" title="day" />
|
||||
{% endblock %}
|
||||
{% block doccontent %}
|
||||
<!-- trim here -->
|
||||
<section epub:type="copyright-page" id="copyright-page">
|
||||
<div class="agate-info">
|
||||
<p>© {{ campaign.preferred_edition.publication_date }} by {{ campaign.work.author }}</p>
|
||||
<p>ISBN: {{ campaign.preferred_edition.isbn }} .</p>
|
||||
<p>© {{ campaign.work.preferred_edition.publication_date }} by {{ campaign.work.author }}</p>
|
||||
<p>ISBN: {{ campaign.work.preferred_edition.isbn_13 }} .</p>
|
||||
<p>URI: <a href="https://unglue.it/{{ campaign.work.id }}/">https://unglue.it/work/{{ campaign.work.id }}/</a> (this work).</p>
|
||||
<p><img src="images/unglueitlogo.png" alt="unglue.it logo" /></p>
|
||||
<p>
|
||||
|
@ -14,7 +21,7 @@
|
|||
<section epub:type="other-credits" id="other-credits">
|
||||
<h2>This is an unglued ebook</h2>
|
||||
<p>
|
||||
Unglued ebooks are made possible through the Unglue.it website by contributions from readers like you.</p>
|
||||
Unglued ebooks are made possible through the Unglue.it website by contributions from {{ campaign.ungluers.all|length }} readers like you.</p>
|
||||
{% if campaign.ungluers.supporters %}
|
||||
<p>Supporters of this edition include ungluers:
|
||||
{% for ungluer in campaign.ungluers.supporters %}
|
||||
|
@ -41,3 +48,6 @@
|
|||
You can say thank you by supporting the ungluing of more books at <a href="https://unglue.it/">https://unglue.it/</a>
|
||||
</p>
|
||||
</section>
|
||||
<!-- trim here -->
|
||||
|
||||
{% endblock %}
|
|
@ -101,7 +101,7 @@ Please fix the following before launching your campaign:
|
|||
<ul class="tabs">
|
||||
<li class="tabs1 {% if activetab == '1' %}active{% endif %}"><a href="#">Description</a></li>
|
||||
<li class="tabs2 {% if activetab == '2' %}active{% endif %}"><a href="#">Premiums</a></li>
|
||||
<li class="tabs3 {% if activetab == '3' %}active{% endif %}"><a href="#">Launch</a></li>
|
||||
<li class="tabs3 {% if activetab == '3' %}active{% endif %}"><a href="#">{% if campaign_status == 'ACTIVE' or campaign_status == 'SUCCESSFUL' %}Progress{% else %}Launch{% endif %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
|
@ -252,8 +252,9 @@ Please fix the following before launching your campaign:
|
|||
</div>
|
||||
{% endifequal %}
|
||||
|
||||
{% ifequal campaign_status 'ACTIVE' %}
|
||||
<div class="tabs-3">
|
||||
{% if campaign_status == 'ACTIVE' or campaign_status == 'SUCCESSFUL' %}
|
||||
{% if campaign_status == 'ACTIVE' %}
|
||||
<h2 class="thank-you">Your campaign is now active! Hooray!</h2>
|
||||
|
||||
<h3>What to do next</h3>
|
||||
|
@ -263,8 +264,13 @@ Please fix the following before launching your campaign:
|
|||
<li>Watch media and social networks for mentions of your campaign, and engage in those conversations.</li>
|
||||
<li>Need help doing any of this? Talk to us.</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
<h3>Campaign Summary</h3>
|
||||
<p> You can see what tiers people have pledged for (or earned) 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!
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endifequal %}
|
||||
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
|
|
@ -42,6 +42,8 @@ urlpatterns = patterns(
|
|||
url(r"^stub/", "stub", name="stub"),
|
||||
url(r"^work/(?P<work_id>\d+)/$", "work", name="work"),
|
||||
url(r"^work/(?P<work_id>\d+)/preview/$", "work", {'action': 'preview'}, name="work_preview"),
|
||||
url(r"^work/(?P<work_id>\d+)/acks/$", "work", {'action': 'acks'}, name="work_acks"),
|
||||
url(r"^work/\d+/acks/images/(?P<file_name>[\w\.]*)$", "static_redirect_view",{'dir': 'images'}),
|
||||
url(r"^work/(?P<work_id>\d+)/librarything/$", "work_librarything", name="work_librarything"),
|
||||
url(r"^work/(?P<work_id>\d+)/goodreads/$", "work_goodreads", name="work_goodreads"),
|
||||
url(r"^work/(?P<work_id>\d+)/openlibrary/$", "work_openlibrary", name="work_openlibrary"),
|
||||
|
|
|
@ -60,6 +60,9 @@ from notification import models as notification
|
|||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
def static_redirect_view(request, file_name, dir=""):
|
||||
return HttpResponseRedirect('/static/'+dir+"/"+file_name)
|
||||
|
||||
def slideshow(max):
|
||||
ending = models.Campaign.objects.filter(status='ACTIVE').order_by('deadline')
|
||||
count = ending.count()
|
||||
|
@ -108,6 +111,10 @@ def stub(request):
|
|||
path = request.path[6:] # get rid of /stub/
|
||||
return render(request,'stub.html', {'path': path})
|
||||
|
||||
def acks(request, work):
|
||||
return render(request,'front_matter.html', {'campaign': work.last_campaign()})
|
||||
|
||||
|
||||
def work(request, work_id, action='display'):
|
||||
try:
|
||||
work = models.Work.objects.get(id = work_id)
|
||||
|
@ -116,7 +123,8 @@ def work(request, work_id, action='display'):
|
|||
work = models.WasWork.objects.get(was = work_id).work
|
||||
except models.WasWork.DoesNotExist:
|
||||
raise Http404
|
||||
|
||||
if action == "acks":
|
||||
return acks( request, work)
|
||||
if request.method == 'POST' and not request.user.is_anonymous():
|
||||
activetab = '4'
|
||||
else:
|
||||
|
|
|
@ -0,0 +1,234 @@
|
|||
@charset "UTF-8";
|
||||
@namespace "http://www.w3.org/1999/xhtml";
|
||||
@namespace epub "http://www.idpf.org/2007/ops";
|
||||
|
||||
/* from https://github.com/mattharrison/epub-css-starter-kit */
|
||||
/* This assumes geometric header shrinkage */
|
||||
/* Also, it tries to make h2 be 1em */
|
||||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
|
||||
/* Note kindle hates margin:0 ! (or margin-left or margin-top set) it inserts newlines galore */
|
||||
/* margin: 0; */
|
||||
margin-right: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
/* font: inherit; */
|
||||
vertical-align: baseline; }
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0; }
|
||||
|
||||
/* end reset */
|
||||
@page {
|
||||
margin-top: 30px;
|
||||
margin-bottom: 20px; }
|
||||
|
||||
div.cover {
|
||||
text-align: center;
|
||||
page-break-after: always;
|
||||
padding: 0px;
|
||||
margin: 0px; }
|
||||
div.cover img {
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
padding: 0px;
|
||||
margin: 0px; }
|
||||
|
||||
.cover-img {
|
||||
height: 100%;
|
||||
max-width: 100%;
|
||||
padding: 0px;
|
||||
margin: 0px; }
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
hyphens: none !important;
|
||||
-moz-hyphens: none !important;
|
||||
-webkit-hyphens: none !important;
|
||||
adobe-hyphenate: none !important;
|
||||
page-break-after: avoid;
|
||||
page-break-inside: avoid;
|
||||
text-indent: 0px;
|
||||
text-align: left; }
|
||||
|
||||
h1 {
|
||||
font-size: 1.6em;
|
||||
margin-bottom: 3.2em; }
|
||||
|
||||
h2 {
|
||||
font-size: 1em;
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0.5em; }
|
||||
|
||||
h3 {
|
||||
font-size: 0.625em; }
|
||||
|
||||
h4 {
|
||||
font-size: 0.391em; }
|
||||
|
||||
h5 {
|
||||
font-size: 0.244em; }
|
||||
|
||||
h6 {
|
||||
font-size: 0.153em; }
|
||||
|
||||
/* Do not indent first paragraph. Mobi will need class='first-para' */
|
||||
h1 + p, h2 + p, h3 + p, h4 + p, h5 + p, h6 + p {
|
||||
text-indent: 0; }
|
||||
|
||||
p {
|
||||
hyphenate-after: 3;
|
||||
hyphenate-before: 3;
|
||||
hyphenate-lines: 2;
|
||||
-webkit-hyphenate-after: 3;
|
||||
-webkit-hyphenate-before: 3;
|
||||
-webkit-hyphenate-lines: 2;
|
||||
line-height: 1.25em;
|
||||
margin: 0;
|
||||
orphans: 2;
|
||||
text-align: justify;
|
||||
text-indent: 1em;
|
||||
widows: 2; }
|
||||
p.first-para {
|
||||
text-indent: 0; }
|
||||
|
||||
.drop {
|
||||
overflow: hidden;
|
||||
line-height: 89%;
|
||||
height: 0.8em;
|
||||
font-size: 281%;
|
||||
margin-right: 0.075em;
|
||||
float: left; }
|
||||
|
||||
/* lists */
|
||||
ul, ol, dl {
|
||||
margin: 1em 0 1em 0; }
|
||||
|
||||
li {
|
||||
line-height: 1.25em;
|
||||
orphans: 2;
|
||||
widows: 2;
|
||||
text-align: justify;
|
||||
text-indent: 0;
|
||||
margin: 0; }
|
||||
|
||||
/* code for me */
|
||||
pre {
|
||||
margin-left: 0;
|
||||
/* margin-top: 1em; */
|
||||
margin-bottom: 1em;
|
||||
/* mobi fun */
|
||||
font-size: 0.6em;
|
||||
font-family: "Courier New", Courier, monospace;
|
||||
white-space: pre-wrap;
|
||||
display: block; }
|
||||
|
||||
div.div-literal-block-admonition {
|
||||
margin-left: 1em; }
|
||||
div.note, div.tip {
|
||||
margin: 1em 0 1em 0 !important;
|
||||
padding: 0 !important;
|
||||
/* kindle is finnicky with borders, bottoms dissappear, width is ignored */
|
||||
border-top: 0px solid #178e7d;
|
||||
border-bottom: 0px dashed #178e7d;
|
||||
page-break-inside: avoid; }
|
||||
|
||||
/* sidebar */
|
||||
p.note-title, .admonition-title {
|
||||
margin-top: 0;
|
||||
/*mobi doesn't like div margins */
|
||||
font-variant: small-caps;
|
||||
font-size: 1em;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
-webkit-hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
hyphens: none;
|
||||
/* margin:0 1em 0 1em; */ }
|
||||
|
||||
div.note p, .note-p {
|
||||
text-indent: 1em;
|
||||
margin-left: 0;
|
||||
margin-right: 0;
|
||||
font-style: italic; }
|
||||
|
||||
/* Since Kindle doesn't like multiple classes have to have combinations */
|
||||
.note-p-first {
|
||||
text-indent: 0;
|
||||
margin-left: 0;
|
||||
margin-right: 0; }
|
||||
|
||||
/* Tables */
|
||||
table {
|
||||
width: 100%;
|
||||
page-break-inside: avoid;
|
||||
border: 1px; }
|
||||
|
||||
td {
|
||||
border-bottom: 1px solid black;
|
||||
font-size: small;
|
||||
hyphens: none;
|
||||
-moz-hyphens: none;
|
||||
-webkit-hyphens: none;
|
||||
padding: 5px !important;
|
||||
page-break-inside: avoid;
|
||||
text-align: left;
|
||||
text-indent: 0;
|
||||
vertical-align: top; }
|
||||
|
||||
sup {
|
||||
vertical-align: super;
|
||||
font-size: 0.5em; }
|
||||
|
||||
sub {
|
||||
vertical-align: sub;
|
||||
font-size: 0.5em; }
|
||||
|
||||
.footnote {
|
||||
font-size: 0.8em; }
|
||||
|
||||
.footnote-link {
|
||||
font-size: 0.8em;
|
||||
vertical-align: super; }
|
||||
|
||||
/* Samples */
|
||||
.center {
|
||||
text-align: center; }
|
||||
|
||||
.right {
|
||||
text-align: right; }
|
||||
|
||||
.left {
|
||||
text-align: left; }
|
||||
|
||||
.f-right {
|
||||
float: right; }
|
||||
|
||||
.f-left {
|
||||
float: left; }
|
||||
|
||||
.box-example {
|
||||
background-color: green;
|
||||
margin: 2em;
|
||||
padding: 1em;
|
||||
border: 2px dashed red; }
|
||||
|
||||
.padding-only {
|
||||
padding: 1em; }
|
||||
|
||||
.margin-only {
|
||||
margin: 2em; }
|
||||
|
||||
div.picture-right {
|
||||
float: right ;
|
||||
margin-bottom: 1em;
|
||||
margin-left: 1em;"}
|
||||
|
||||
.aut {
|
||||
text-align: center ;
|
||||
font-style: italic; }
|
||||
|
||||
.agate-info {
|
||||
font-size: 80%; }
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue