filtered chunks table,
[redakcja.git] / apps / catalogue / templates / catalogue / document_list.html
1 {% extends "catalogue/base.html" %}
2
3 {% load i18n %}
4 {% load pagination_tags %}
5 {% load set_get_parameter catalogue %}
6
7 {% block extrabody %}
8 {{ block.super }}
9 <script type="text/javascript" charset="utf-8">
10 $(function() {
11     $("select.filter").change(function() {
12         window.location.href = this.value;
13     });
14 });
15 </script>
16 {% endblock %}
17
18 {% block leftcolumn %}
19
20     <form method="get" action="#">
21     <table id="file-list">
22         <thead><tr>
23             <th></th>
24             <th></th>
25             <th></th>
26             <th><select name="stage" class="filter">
27                 <option value="{% set_get_parameter stage=,page= %}">- {% trans "filter by stage" %} -</option>
28                 <option {% if request.GET.stage == '' %}selected="selected"
29                         {% endif %}value="{% set_get_parameter stage='',page= %}">- {% trans "empty" %} -</option>
30                 {% for stage in stages %}
31                     <option {% if request.GET.stage == stage.slug %}selected="selected"
32                         {% endif %}value="{% set_get_parameter stage=stage.slug,page= %}">{{ stage.name }}</option>
33                 {% endfor %}
34             </select></th>
35             <th><select name="user" class="filter">
36                 <option value="{% set_get_parameter user=,page= %}">- {% trans "filter by user" %} -</option>
37                 <option {% if request.GET.user == '' %}selected="selected"
38                         {% endif %}value="{% set_get_parameter user='',page= %}">- {% trans "empty" %} -</option>
39                 {% for user in users %}
40                     <option {% if request.GET.user == user.username %}selected="selected"
41                         {% endif %}value="{% set_get_parameter user=user.username,page= %}">{{ user.first_name }} {{ user.last_name }} ({{ user.count }})</option>
42                 {% endfor %}
43             </select></th>
44         </tr></thead>
45
46         <tbody>
47         {% autopaginate books 100 %}
48         {% if not books %}
49             <tr><td>{% trans "No books found." %}</td></tr>
50         {% endif %}
51         {% for item in books %}
52             {% with item.book as book %}
53
54             {% ifequal item.book_length 1 %}
55                 {% with item.chunks.0 as chunk %}
56                 <tr>
57                     <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
58                     <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
59                     <td><a target="_blank"
60                                 href="{% url wiki_editor book.slug %}">
61                                 {{ book.title }}</a></td>
62                     <td>{% if chunk.stage %}
63                         ({{ chunk.stage }})
64                     {% endif %}</td>
65                     <td>{% if chunk.user %}{{ chunk.user.first_name }} {{ chunk.user.last_name }}{% endif %}</td>
66                 </tr>
67                 {% endwith %}
68             {% else %}
69                 <tr>
70                     <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
71                     <td></td>
72                     <td>{{ book.title }}</td>
73                 </tr>
74                 {% for chunk in item.chunks %}
75                     <tr>
76                         <td></td>
77                         <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
78                         <td><a target="_blank" href="{{ chunk.get_absolute_url }}">
79                                 <span class='chunkno'>{{ chunk.number }}.</span>
80                                 {{ chunk.comment }}</a></td>
81                         <td>({{ chunk.stage }})</td>
82                         <td>{% if chunk.user %}<a href="{% url catalogue_user chunk.user.username %}">{{ chunk.user.first_name }} {{ chunk.user.last_name }}</a>{% endif %}</td>
83                     </td></tr>
84                 {% endfor %}
85             {% endifequal %}
86             {% endwith %}
87         {% endfor %}
88         <tr><td colspan="3">{% paginate %}</td></tr>
89                 </tbody>
90     </table>
91         </form>
92 {% endblock leftcolumn %}
93
94 {% block rightcolumn %}
95         <div id="last-edited-list">
96                 <h2>{% trans "Your last edited documents" %}</h2>
97             <ol>
98                         {% for slugs, item in last_books %}
99                         <li><a href="{% url wiki_editor slugs.0 slugs.1 %}"
100                                 target="_blank">{{ item.title }}</a><br/><span class="date">({{ item.time|date:"H:i:s, d/m/Y" }})</span></li>
101                         {% endfor %}
102                 </ol>
103         </div>
104
105     <h2>{% trans "Recent activity" %}</h2>
106     {% wall %}
107 {% endblock rightcolumn %}