[deliver #24088823] rights and filetype images for pd, cc books

pull/1/head
eric 2012-04-26 17:26:27 -04:00
parent c6b05bd577
commit 274762d7de
9 changed files with 37 additions and 9 deletions

View File

@ -587,6 +587,30 @@ class Ebook(models.Model):
def set_provider(self):
self.provider=Ebook.infer_provider(self.url)
return self.provider
@property
def rights_badge(self):
my_rights=self.rights
if not my_rights:
return 'https://i.creativecommons.org/p/mark/1.0/88x31.png'
if my_rights == 'PD-US':
return 'https://i.creativecommons.org/p/mark/1.0/88x31.png'
elif my_rights == 'CC0':
return 'https://i.creativecommons.org/p/zero/1.0/88x31.png'
elif my_rights == 'CC BY':
return 'https://i.creativecommons.org/l/by/3.0/88x31.png'
elif my_rights == 'CC BY-NC-ND':
return 'https://i.creativecommons.org/l/by-nc-nd/3.0/88x31.png'
elif my_rights == 'CC BY-NC-SA':
return 'https://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png'
elif my_rights == 'CC BY-NC':
return 'https://i.creativecommons.org/l/by-nc/3.0/88x31.png'
elif my_rights == 'CC BY-SA':
return 'https://i.creativecommons.org/l/by-sa/3.0/88x31.png'
elif my_rights == 'CC BY-ND':
return 'https://i.creativecommons.org/l/by-nd/3.0/88x31.png'
else:
return ''
@classmethod
def infer_provider(klass, url):

View File

@ -141,7 +141,7 @@
{% else %}{% if first_ebook %}
<span class="listview boolist-ebook">
{% for ebook in work.ebooks|slice:":3" %}
<a href="{{ebook.url}}">{{ ebook.format }}</a>
<a href="{{ ebook.url }}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt="{{ ebook.rights}} {{ ebook.format }} at {{ebook.provider}}" title="{{ ebook.rights}} {{ ebook.format }} at {{ebook.provider}}" /></a>
{% endfor %}
</span>
{% else %}

View File

@ -110,9 +110,20 @@ $j(document).ready(function(){
{% endif %}
</div>
</div>
{% if work.first_ebook %}
<div class="get-book">
<label>Get it:</label>
<span class="find-link">
{% for ebook in work.ebooks %}
<a href="{{ ebook.url }}"><img src="/static/images/{{ ebook.format }}32.png" height="32" alt=" {{ ebook.format }} at {{ebook.provider}}" title=" {{ ebook.format }} at {{ebook.provider}}" /><img src="{{ebook.rights_badge}}" height="31" width="88" alt="{{ebook.rights}}" title="{{ebook.rights}}" /></a>
{% endfor %}
</span>
</div>
{% endif %}
<div class="find-book">
<label>Find it:</label>
<div class="find-link">
<div class="find-link">
<a id="find-google" href="{{ work.googlebooks_url }}"><img src="/static/images/supporter_icons/googlebooks_square.png" title="Find on Google Books" alt="Find on Google Books" /></a>
<a rel="nofollow" class="find-openlibrary" href="{% url work_openlibrary work.id %}"><img src="/static/images/supporter_icons/openlibrary_square.png" title="Find on OpenLibrary" alt="Find on OpenLibrary" /></a>
{% if not request.user.is_anonymous %}
@ -167,13 +178,6 @@ $j(document).ready(function(){
<span id="w{{ work.googlebooks_id }}">Add to Wishlist</span>
</div>
{% endif %}{% endif %}{% endif %}
{% if work.first_ebook %}
<span class="boolist-ebook">
{% for ebook in work.ebooks %}
<a href="{{ ebook.url }}">{{ ebook.format }}</a> {{ebook.rights}} at {{ebook.provider}}<br />
{% endfor %}
</span>
{% endif %}
</div>
</div>
</div>

BIN
static/images/EPUB32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
static/images/HTML32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
static/images/MOBI32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
static/images/PDF32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
static/images/TEXT32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB