mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-29 19:40:32 +00:00
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 {
|
div.pulldown-button {
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border: 2px solid #247BA0;
|
|
||||||
border-radius: 0.3em;
|
border-radius: 0.3em;
|
||||||
color: #247BA0;
|
color: #247BA0;
|
||||||
width: max-content;
|
width: max-content;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
.post div.pulldown-button {
|
||||||
|
border: 2px solid #247BA0;
|
||||||
|
}
|
||||||
|
|
||||||
.pulldown-button form {
|
.pulldown-button form {
|
||||||
display: inline;
|
display: inline;
|
||||||
|
@ -348,9 +350,12 @@ button, input[type="submit"] {
|
||||||
}
|
}
|
||||||
button.secondary {
|
button.secondary {
|
||||||
background-color: #EEE;
|
background-color: #EEE;
|
||||||
border: 2px solid #247BA0;
|
|
||||||
color: #247BA0;
|
color: #247BA0;
|
||||||
}
|
}
|
||||||
|
.post button.secondary {
|
||||||
|
border: 2px solid #247BA0;
|
||||||
|
}
|
||||||
|
|
||||||
button.warning {
|
button.warning {
|
||||||
background-color: #FF1654;
|
background-color: #FF1654;
|
||||||
}
|
}
|
||||||
|
@ -499,6 +504,7 @@ button .icon {
|
||||||
.book-preview {
|
.book-preview {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.book-preview.grid {
|
.book-preview.grid {
|
||||||
float: left;
|
float: left;
|
||||||
|
@ -597,9 +603,6 @@ dd {
|
||||||
width: auto;
|
width: auto;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
.covers-shelf button, .covers-shelf .pulldown-button {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
float: right;
|
float: right;
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
|
{% load fr_display %}
|
||||||
{% if book.cover %}
|
{% if book.cover %}
|
||||||
<img class="book-cover {{ size }}" src="/images/{{ book.cover }}" alt="{% include 'snippets/cover_alt.html' with book=book %}">
|
<img class="book-cover {{ size }}" src="/images/{{ book.cover }}" alt="{% include 'snippets/cover_alt.html' with book=book %}">
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="no-cover book-cover {{ size }}">
|
<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>
|
<div>
|
||||||
<p class="title">{{ book.title }}</p>
|
<p class="title">{{ book.title }}</p>
|
||||||
<p>{{ book.authors.first.name }}</p>
|
<p>({{ book|edition_info }})</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% 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()
|
).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)
|
@register.simple_tag(takes_context=True)
|
||||||
def shelve_button_identifier(context, book):
|
def shelve_button_identifier(context, book):
|
||||||
''' check what shelf a user has a book on, if any '''
|
''' check what shelf a user has a book on, if any '''
|
||||||
|
|
Loading…
Reference in a new issue