Updating campaign widget to show status and progress. Don't have a way to calculate a graphic representation of progress yet.

pull/1/head
Raymond Yee 2011-10-19 09:45:25 -07:00
parent cbb801b9d9
commit 0ed1d229f5
3 changed files with 18 additions and 10 deletions

View File

@ -1,5 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<title>unglue.it: {% block title %}{% endblock %}</title>
@ -24,10 +23,10 @@
<b>{{ work.title }}</b>
<p>{{ work.authors.all.0.name }}</p>
<p><b>Genre:</b>{{work.subjects.all.0.name}}</p>
<p class="status, undefined"><b>Status:</b> Unglued!</p>
<p class="status"><b>Status:</b>{{campaign.status}}</p>
<div class="read">
<img src="/static/images/book-panel/percent.png" />
<p class="undefined">100%</p>
<p>{{progress}}%</p>
<p class="right_add">
<img src="/static/images/book-panel/add_gray.png" border="0" />
</p>
@ -35,9 +34,9 @@
<span style="display: none;">
<div class="book_panel_back">
<div class="unglued_white">
<b class="undefined">Unglued?</b>
<p>{{campaigns.0.deadline.date}}</p>
<p class="undefined"><b>Raised:</b> $12,000</p>
<b>Unglued?</b>
<p>{{campaign.deadline.date}}</p>
<p class="undefined"><b>Raised:</b>${{campaign.current_total}}</p>
</div>
<div class="read_itbutton">
<a href="#">Read it Now</a>
@ -49,7 +48,7 @@
<b><a href="#">{{ work.title }}</a></b>
<p><a href="#">{{ work.authors.all.0.name }}</a></p>
<p><b>Genre:</b>{{work.subjects.all.0.name}}</p>
<p class="undefined"><b>Status:</b> In Progress</p>
<p><b>Status:</b>{{campaign.status}}</p>
</div>
<div id="moreinfo">
<a href="#">More Info</a>

View File

@ -64,8 +64,17 @@ def widget(request,isbn):
else:
logged_in_username = None
# for now pass in first campaign -- but should loop through to prioritize any active campaigns
if len(campaigns):
campaign = campaigns[0]
progress = int(100*campaign.current_total/campaign.target)
else:
campaign = None
progress = None
return render_to_response('widget.html',
{'isbn':isbn,'edition':edition, 'work':work, 'campaigns':campaigns, 'logged_in_username':logged_in_username},
{'isbn':isbn,'edition':edition, 'work':work, 'campaign':campaign, 'progress': progress,
'logged_in_username':logged_in_username},
context_instance=RequestContext(request)
)

View File

@ -72,10 +72,10 @@ PAYPAL_SANDBOX_PASSWORD = ''
PAYPAL_BUYER_LOGIN =''
PAYPAL_BUYER_PASSWORD = ''
PAYPAL_GLUEJAR_EMAIL = ""
PAYPAL_GLUEJAR_EMAIL = "glueja_1317336101_biz@gluejar.com"
# for test purposes have a single RH paypal email
PAYPAL_TEST_RH_EMAIL = "rh1_1317336251_biz@gluejar.com"
PAYPAL_TEST_NONPROFIT_PARTNER_EMAIL = ""
PAYPAL_TEST_NONPROFIT_PARTNER_EMAIL = "nppart_1318957063_per@gluejar.com"
BASE_URL = 'http://0.0.0.0/'