Use a new tinted book set on every page
[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       }
36     </style>
37   {% endif %}
38
39   {% if review_entry.book.cover_image %}
40     <div class="book-cover">
41       {% set book = review_entry.book %}
42       {% include "_book_cover.html" %}
43     </div>
44   {% endif %}
45
46   <h1><span class="book-title">{{ review_entry.book.title | smartypants | safe }}</span></h1>
47
48   <table class="book_metadata">
49     <tr>
50       <td>author{% if "and" in review_entry.book.author or ", " in review_entry.book.author or " & " in review_entry.book.author %}s{% endif %}:</td>
51       <th>{{ review_entry.book.author }}
52         {%- if review_entry.book.publication_year %}
53           ({{ review_entry.book.publication_year}})
54         {%- endif -%}
55       </th>
56     </tr>
57     {% if review_entry.review.date_read %}
58     <tr>
59       <td>date read:</td>
60       <th>{{ review_entry.review.date_read | render_date }}
61         {% if review_entry.review.did_not_finish %}
62         <span class="did_not_finish">
63           (did not finish)
64         </span>
65         {% endif %}
66       </th>
67     </tr>
68     {% endif %}
69     {% if review_entry.review.rating %}
70     <tr>
71       <td>rating:</td>
72       <th>
73         {% for _ in range(review_entry.review.rating) %}
74         ★
75         {% endfor %}
76         {% for _ in range(5 - review_entry.review.rating) %}
77         ☆
78         {% endfor %}
79         {% if review_entry.review.did_not_finish %}
80         (did not finish)
81         {% endif %}
82       </th>
83     </tr>
84     {% endif %}
85   </table>
86
87   <div class="review">
88     {{ review_entry.review.text | render_markdown | safe }}
89
90     <p>(see <a href="/reviews">all reviews</a>)</p>
91   </div>
92 {% endblock %}