Merge branch 'development' of helene.linode:/mnt/repos/books.alexwlchan.net into...
[books.alexwlchan.net] / templates / review.html
1 {% extends "base.html" %}
2
3 {% block head_content %}
4 <meta name="twitter:card" content="summary">
5 <meta name="twitter:site" content="@alexwlchan"/>
6 <meta name="twitter:title" content="alexwlchan's review of {{ review_entry.book.title }}"/>
7 <meta name="twitter:image" content="https://books.alexwlchan.net/squares/{{ review_entry.book.cover_image }}"/>
8
9 <meta property="og:type" content="article" />
10 <meta property="og:url" content="https://books.alexwlchan.net/{{ review_entry.out_path() }}">
11 <meta property="og:title" content="alexwlchan's review of {{ review_entry.book.title }}">
12 <meta property="og:image" content="https://books.alexwlchan.net/squares/{{ review_entry.book.cover_image }}"/>
13 {% endblock %}
14
15 {% block content %}
16   {% if tint_colors[review_entry.book.cover_image] %}
17     {% set r = tint_colors[review_entry.book.cover_image][0] * 255 | int %}
18     {% set g = tint_colors[review_entry.book.cover_image][1] * 255 | int %}
19     {% set b = tint_colors[review_entry.book.cover_image][2] * 255 | int %}
20     <style>
21       .review a {
22         color: rgb({{ r }}, {{ g }}, {{ b }});
23       }
24
25       .review a:hover {
26         background: rgb({{ r }}, {{ g }}, {{ b }}, 0.3);
27       }
28
29       .book-cover img {
30         box-shadow: 0px 5px 5px rgba({{ r }}, {{ g }}, {{ b }}, 0.25);
31       }
32
33       aside #shelf_background {
34         background: url({{ tint_colors[review_entry.book.cover_image] | create_shelf_data_uri }});
35         background-size: auto 100%;
36       }
37     </style>
38   {% endif %}
39
40   {% if review_entry.book.cover_image %}
41     <div class="book-cover">
42       {% set book = review_entry.book %}
43       {% include "_book_cover.html" %}
44     </div>
45   {% endif %}
46
47   <h1><span class="book-title">{{ review_entry.book.title | smartypants | safe }}</span></h1>
48
49   <table class="book_metadata">
50     <tr>
51       <td>author{% if "and" in review_entry.book.author or ", " in review_entry.book.author or " & " in review_entry.book.author %}s{% endif %}:</td>
52       <th>{{ review_entry.book.author }}
53         {%- if review_entry.book.publication_year %}
54           ({{ review_entry.book.publication_year}})
55         {%- endif -%}
56       </th>
57     </tr>
58     {% if review_entry.review.date_read %}
59     <tr>
60       <td>date read:</td>
61       <th>{{ review_entry.review.date_read | render_date }}
62         {% if review_entry.review.did_not_finish %}
63         <span class="did_not_finish">
64           (did not finish)
65         </span>
66         {% endif %}
67       </th>
68     </tr>
69     {% endif %}
70     {% if review_entry.review.rating %}
71     <tr>
72       <td>rating:</td>
73       <th>
74         {% for _ in range(review_entry.review.rating) %}
75         ★
76         {% endfor %}
77         {% for _ in range(5 - review_entry.review.rating) %}
78         ☆
79         {% endfor %}
80         {% if review_entry.review.did_not_finish %}
81         (did not finish)
82         {% endif %}
83       </th>
84     </tr>
85     {% endif %}
86   </table>
87
88   <div class="review">
89     {{ review_entry.review.text | render_markdown | safe }}
90
91     <p>(see <a href="/reviews">all reviews</a>)</p>
92   </div>
93 {% endblock %}