Add "jump to" year links
[books.alexwlchan.net] / templates / list_reviews.html
1 {% extends "base.html" %}
2
3 {% block content %}
4   <p class="nav">
5     <a class="selected" href="/reviews">read</a> /
6     <a href="/reading">reading</a> /
7     <a href="/to-read">to read</a>
8   </p>
9
10   <h2>books i&rsquo;ve read</h2>
11
12   <p id="jump_to">jump to:
13     {% for year, _ in all_reviews %}
14     <a href="#books_by_year_{{ year }}">
15       {% if year %}{{ year }}{% else %}other times{% endif -%}
16     </a>
17     {% if not loop.last %} / {% endif %}
18     {% endfor %}
19   </p>
20
21   {% for year, reviews in all_reviews %}
22   <div class="divider">{{ loop.cycle('&#x2766;', '&#x2767;') | safe }}</div>
23
24   <div class="books_by_year" id="books_by_year_{{ year }}">
25     <h3>the {{ reviews|length }} book{% if reviews|length != 1 %}s{% endif %}
26       {% if year == this_year %}
27         i&rsquo;ve read so far
28       {% else %}
29         i read
30       {% endif %}
31
32       {% if year %}
33         in {{ year }}
34       {% else %}
35         at another time
36       {% endif %}
37     </h3>
38
39     {% for review_entry in reviews %}
40     <div class="review_preview">
41       <a href="/{{ review_entry.out_path() }}">
42         <div class="book_thumbnail">
43           {% set book = review_entry.book %}
44           {% include "_book_cover.html" %}
45         </div>
46
47         <div class="book_metadata">
48           <p class="title">{{ review_entry.book.title }}</p>
49           <p>
50             <small>
51               by {{ review_entry.book.author }}
52               {%- if review_entry.book.publication_year %}
53                 ({{ review_entry.book.publication_year}})
54               {%- endif -%}
55                 <br/>
56               {% if review_entry.review.date_read %}
57               read {{ review_entry.review.date_read | render_date }}
58                 <br/>
59               {% endif %}
60               {% for _ in range(review_entry.review.rating) %}
61               ★
62               {% endfor %}
63               {% for _ in range(5 - review_entry.review.rating) %}
64               ☆
65               {% endfor %}
66               {% if review_entry.review.did_not_finish %}
67               (did not finish)
68               {% endif %}
69             </small>
70           </p>
71         </div>
72       </a>
73     </div>
74     {% endfor %}
75   </div>
76
77   {% endfor %}
78 {% endblock %}