Searching, filtering fixes.
[wolnelektury.git] / src / catalogue / templates / catalogue / 2022 / book_list.html
1 {% extends '2022/base.html' %}
2 {% load catalogue_tags %}
3 {% load thumbnail %}
4 {% load pagination_tags %}
5
6 {% load choose_cites from social_tags %}
7
8
9 {% block breadcrumbs %}
10   <a href="/katalog/"><span>Katalog</span></a>
11   {% if main_tag %}
12     <a href="{{ main_tag.get_absolute_catalogue_url }}"><span>{{ main_tag.get_category_display|title }}</span></a>
13   {% endif %}
14 {% endblock %}
15
16 {% block main %}
17   <div class="l-section">
18     <div class="l-author__header">
19       {% if main_tag.photo %}
20         {% thumbnail main_tag.photo '40x40' crop='center' as th %}
21         <figure>
22           <img src="{{ th.url }}" alt="{{ main_tag.name }}">
23         </figure>
24         {% endthumbnail %}
25       {% endif %}
26       <h1>
27         {% if main_tag %}
28           {{ main_tag.name }}
29         {% else %}
30           {{ view.title }}
31         {% endif %}
32       </h1>
33     </div>
34   </div>
35
36   <div class="l-section">
37     <div class="l-books__header">
38       <div class="l-books__input">
39         <i class="icon icon-filter"></i>
40         <input type="text" placeholder="filtry, tytuł" class="quick-filter" data-for="book-list" data-filters="with-filter" value="{{ request.GET.search }}">
41         <div class="filter-container">
42           {% for tag in tags %}
43             {% if tag is not main_tag %}
44               <span class="filter filter-category-{{ tag.category }}">
45                 <a href="{% catalogue_url view.list_type tag %}">{{ tag }}</a>
46                 <a href="{% catalogue_url view.list_type tags -tag %}">✖</a>
47               </span>
48             {% endif %}
49           {% endfor %}
50         </div>
51
52       </div>
53       {% if view.get_orderings %}
54       <div class="l-books__sorting">
55         <span>Sortuj:</span>
56         <div>
57           {% for ordering in view.get_orderings %}
58             <button
59                 {% if ordering.default %}
60                 data-order="-"
61                 {% else %}
62                 data-order="{{ ordering.slug }}"
63                 {% endif %}
64                 {% if ordering.active %}
65                 class="is-active"
66                 {% endif %}
67             >{{ ordering.name }}</button>
68           {% endfor %}
69           <select name="sorting">
70             {% for ordering in view.get_orderings %}
71               <option
72                   {% if ordering.default %}
73                   value="-"
74                   {% else %}
75                   value="{{ ordering.slug }}"
76                   {% endif %}
77                   {% if ordering.active %}
78                   selected="selected"
79                   {% endif %}
80               >{{ ordering.name }}</option>
81           {% endfor %}
82           </select>
83         </div>
84       </div>
85       {% endif %}
86     </div>
87   </div>
88   <div class="l-section">
89   <div class="with-filter">
90     <div class="row">
91       <h2 class="header">{% nice_title_from_tags tags suggested_tags_by_category %}</h2>
92       {% if suggested_tags %}
93         <div class="filter-container">
94           {% for tag in suggested_tags %}
95             <span class="filter filter-category-{{ tag.category }}">
96               <a href="{% catalogue_url view.list_type tags tag %}">{{ tag }}</a>
97             </span>
98           {% endfor %}
99         </div>
100       {% endif %}
101     </div>
102   </div>
103   </div>
104
105   {% autopaginate object_list view.page_size %}
106
107   <div class="l-section l-section--col">
108     <div class="l-books__grid" id="book-list">
109       {% for book in object_list %}
110         {% include "catalogue/2022/book_box.html" %}
111       {% endfor %}
112     </div>
113   </div>
114
115   <div id="paginator">
116     {% paginate using '2022/paginate.html' %}
117   </div>
118
119   {% if main_tag %}
120     <section class="l-section">
121       <div class="l-author">
122         {% with tag=main_tag %}
123           {% include 'catalogue/2022/author_box.html' %}
124         {% endwith %}
125         {% choose_cites 3 author=main_tag as cites %}
126         {% if cites %}
127           <div class="row">
128             <div class="l-author__quotes">
129               <div class="l-author__quotes__slider">
130
131                 {% for fragment in cites %}
132                   <div class="l-author__quotes__slider__item">
133                     {% include "catalogue/2022/fragment_slider_box.html" %}
134                   </div>
135                 {% endfor %}
136
137               </div>
138             </div>
139           </div>
140         {% endif %}
141       </div>
142     </section>
143     {% endif %}
144 {% endblock %}