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