Merge pull request #356 from Gluejar/add_dropbox

purchased copies need full url
pull/1/head
Raymond Yee 2014-05-22 19:46:22 -07:00
commit 49682064da
2 changed files with 5 additions and 3 deletions

View File

@ -169,11 +169,11 @@ $j(document).ready(function() {
<div class="ebook_download">
<a href="{{ formats.epub }}"><img src="/static/images/epub32.png" height="32" alt="epub" title="epub" /></a>
<a href="{{ formats.epub }}">EPUB</a> (for iBooks, Nook, Kobo)
<a class="dropbox-saver" href="{{ formats.epub }}" data-filename="unglueit-{{ work.id }}.epub"></a>
<a class="dropbox-saver" href="{{ xfer_url }}" data-filename="unglueit-{{ work.id }}.epub"></a>
<br /><br />
<a href="{{ formats.mobi }}"><img src="/static/images/mobi32.png" height="32" alt="mobi" title="mobi" /></a>
<a href="{{ formats.mobi }}">MOBI</a> (for Kindle)
<a class="dropbox-saver" href="{{ formats.mobi }}" data-filename="unglueit-{{ work.id }}.mobi"></a>
<a class="dropbox-saver" href="{{ kindle_url }}" data-filename="unglueit-{{ work.id }}.mobi"></a>
</div>
{% endifequal %}
{% endif %}

View File

@ -2712,7 +2712,7 @@ class DownloadView(PurchaseView):
unglued_ebooks = work.ebooks().filter(edition__unglued=True)
other_ebooks = work.ebooks().filter(edition__unglued=False)
xfer_url = kindle_url = None
acq=None
formats = {} # a dict of format name and url
for ebook in work.ebooks().all():
@ -2734,6 +2734,7 @@ class DownloadView(PurchaseView):
formats['epub']= reverse('download_acq', kwargs={'nonce':acq.nonce, 'format':'epub'})
formats['mobi']= reverse('download_acq', kwargs={'nonce':acq.nonce, 'format':'mobi'})
xfer_url = settings.BASE_URL_SECURE + formats['epub']
kindle_url = settings.BASE_URL_SECURE + formats['mobi']
can_kindle = True
break
@ -2769,6 +2770,7 @@ class DownloadView(PurchaseView):
'other_ebooks': other_ebooks,
'formats': formats,
'xfer_url': xfer_url,
'kindle_url': kindle_url,
'dropbox_key': settings.DROPBOX_KEY,
'can_kindle': can_kindle,
'base_url': settings.BASE_URL_SECURE,