Allow specifying an editor as well as/instead of an author
[books.alexwlchan.net] / templates / review.html
index 91d9f1f..7b5a7b5 100644 (file)
@@ -1,6 +1,42 @@
 {% extends "base.html" %}
 
+{% block head_content %}
+<meta name="twitter:card" content="summary">
+<meta name="twitter:site" content="@alexwlchan"/>
+<meta name="twitter:title" content="alexwlchan's review of {{ review_entry.book.title }}"/>
+<meta name="twitter:image" content="https://books.alexwlchan.net/squares/{{ review_entry.book.cover_image }}"/>
+
+<meta property="og:type" content="article" />
+<meta property="og:url" content="https://books.alexwlchan.net/{{ review_entry.out_path() }}">
+<meta property="og:title" content="alexwlchan's review of {{ review_entry.book.title }}">
+<meta property="og:image" content="https://books.alexwlchan.net/squares/{{ review_entry.book.cover_image }}"/>
+{% endblock %}
+
 {% block content %}
+  {% if tint_colors[review_entry.book.cover_image] %}
+    {% set r = tint_colors[review_entry.book.cover_image][0] * 255 | int %}
+    {% set g = tint_colors[review_entry.book.cover_image][1] * 255 | int %}
+    {% set b = tint_colors[review_entry.book.cover_image][2] * 255 | int %}
+    <style>
+      .review a {
+        color: rgb({{ r }}, {{ g }}, {{ b }});
+      }
+
+      .review a:hover {
+        background: rgb({{ r }}, {{ g }}, {{ b }}, 0.3);
+      }
+
+      .book-cover img {
+        box-shadow: 0px 5px 5px rgba({{ r }}, {{ g }}, {{ b }}, 0.25);
+      }
+
+      aside #shelf_background {
+        background: url({{ tint_colors[review_entry.book.cover_image] | create_shelf_data_uri }});
+        background-size: auto 100%;
+      }
+    </style>
+  {% endif %}
+
   {% if review_entry.book.cover_image %}
     <div class="book-cover">
       {% set book = review_entry.book %}
     </div>
   {% endif %}
 
-  <h1>My review of <span class="book-title">{{ review_entry.book.title | smartypants | safe }}</span></h1>
+  <h1><span class="book-title">{{ review_entry.book.title | smartypants | safe }}</span></h1>
 
   <table class="book_metadata">
-    <tr>
-      <td>author{% if "and" in review_entry.book.author or ", " in review_entry.book.author or " & " in review_entry.book.author %}s{% endif %}:</td>
-      <th>{{ review_entry.book.author }}
-        {%- if review_entry.book.publication_year %}
-          ({{ review_entry.book.publication_year}})
-        {%- endif -%}
-      </th>
-    </tr>
+    {% if review_entry.book.author %}
+      <tr>
+        <td>author{% if "and" in review_entry.book.author or ", " in review_entry.book.author or " & " in review_entry.book.author %}s{% endif %}:</td>
+        <th>{{ review_entry.book.author }}
+          {%- if review_entry.book.publication_year %}
+            ({{ review_entry.book.publication_year}})
+          {%- endif -%}
+        </th>
+      </tr>
+    {% endif %}
+    {% if review_entry.book.editor %}
+      <tr>
+        <td>editor{% if "and" in review_entry.book.editor or ", " in review_entry.book.editor or " & " in review_entry.book.editor %}s{% endif %}:</td>
+        <th>{{ review_entry.book.editor }}
+          {%- if review_entry.book.publication_year %}
+            ({{ review_entry.book.publication_year}})
+          {%- endif -%}
+        </th>
+      </tr>
+    {% endif %}
     {% if review_entry.review.date_read %}
     <tr>
       <td>date read:</td>
-      <th>{{ review_entry.review.date_read | render_date }}</th>
+      <th>{{ review_entry.review.date_read | render_date }}
+        {% if review_entry.review.did_not_finish %}
+        <span class="did_not_finish">
+          (did not finish)
+        </span>
+        {% endif %}
+      </th>
     </tr>
     {% endif %}
     {% if review_entry.review.rating %}
@@ -43,7 +97,9 @@
     {% endif %}
   </table>
 
-  {{ review_entry.review.text | render_markdown | safe }}
+  <div class="review">
+    {{ review_entry.review.text | render_markdown | safe }}
 
-  <p>(see <a href="/reviews">all reviews</a>)</p>
+    <p>(see <a href="/reviews">all reviews</a>)</p>
+  </div>
 {% endblock %}