forked from mirrors/bookwyrm
Cleans up alt tag generation for covers
This commit is contained in:
parent
e9be06538f
commit
984cafb28e
5 changed files with 26 additions and 9 deletions
|
@ -170,13 +170,15 @@ body {
|
|||
|
||||
div.pulldown-button {
|
||||
background-color: #eee;
|
||||
border: 2px solid #247BA0;
|
||||
border-radius: 0.3em;
|
||||
color: #247BA0;
|
||||
width: max-content;
|
||||
margin: 0 auto;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.post div.pulldown-button {
|
||||
border: 2px solid #247BA0;
|
||||
}
|
||||
|
||||
.pulldown-button form {
|
||||
display: inline;
|
||||
|
@ -348,9 +350,12 @@ button, input[type="submit"] {
|
|||
}
|
||||
button.secondary {
|
||||
background-color: #EEE;
|
||||
border: 2px solid #247BA0;
|
||||
color: #247BA0;
|
||||
}
|
||||
.post button.secondary {
|
||||
border: 2px solid #247BA0;
|
||||
}
|
||||
|
||||
button.warning {
|
||||
background-color: #FF1654;
|
||||
}
|
||||
|
@ -499,6 +504,7 @@ button .icon {
|
|||
.book-preview {
|
||||
overflow: hidden;
|
||||
z-index: 1;
|
||||
text-align: center;
|
||||
}
|
||||
.book-preview.grid {
|
||||
float: left;
|
||||
|
@ -597,9 +603,6 @@ dd {
|
|||
width: auto;
|
||||
margin: 0;
|
||||
}
|
||||
.covers-shelf button, .covers-shelf .pulldown-button {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.close {
|
||||
float: right;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
{% for book in editions %}
|
||||
<li class="book-preview">
|
||||
<a href="{{ book.absolute_id }}">
|
||||
{% include 'snippets/book_cover.html' with book=book %}
|
||||
{% include 'snippets/book_cover.html' with book=book %}
|
||||
</a>
|
||||
{% include 'snippets/shelve_button.html' with book=book %}
|
||||
</li>
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
{% load fr_display %}
|
||||
{% if book.cover %}
|
||||
<img class="book-cover {{ size }}" src="/images/{{ book.cover }}" alt="{% include 'snippets/cover_alt.html' with book=book %}">
|
||||
{% else %}
|
||||
<div class="no-cover book-cover {{ size }}">
|
||||
<img class="book-cover {{ size }}" src="/static/images/no_cover.jpg" alt="{% include 'snippets/cover_alt.html' with book=book %}">
|
||||
<img class="book-cover {{ size }}" src="/static/images/no_cover.jpg" alt="No cover">
|
||||
<div>
|
||||
<p class="title">{{ book.title }}</p>
|
||||
<p>{{ book.authors.first.name }}</p>
|
||||
<p>({{ book|edition_info }})</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
'{{ book.title }}' Cover ({% if book.physical_format %}{{ book.physical_format }}{% if book.published_date %}, {% endif %}{% endif %}{% if book.published_date %}{{ book.published_date.year }}{% endif %})
|
||||
{% load fr_display %}
|
||||
'{{ book.title }}' Cover ({{ book|edition_info }})
|
||||
|
|
|
@ -118,6 +118,18 @@ def get_boosted(boost):
|
|||
).get()
|
||||
|
||||
|
||||
@register.filter(name='edition_info')
|
||||
def get_edition_info(book):
|
||||
''' paperback, French language, 1982 '''
|
||||
items = [
|
||||
book.physical_format,
|
||||
book.languages[0] + ' language' if book.languages and \
|
||||
book.languages[0] != 'English' else None,
|
||||
str(book.published_date.year) if book.published_date else None,
|
||||
]
|
||||
return ', '.join(i for i in items if i)
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def shelve_button_identifier(context, book):
|
||||
''' check what shelf a user has a book on, if any '''
|
||||
|
|
Loading…
Reference in a new issue