3473b596445cf23aa1b650613c5a2b492991a6ca
[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
36             {% if not viewed_user %}
37                 <th><select name="user" class="filter">
38                     <option value="{% set_get_parameter user=,page= %}">- {% trans "filter by user" %} -</option>
39                     <option {% if request.GET.user == '' %}selected="selected"
40                             {% endif %}value="{% set_get_parameter user='',page= %}">- {% trans "empty" %} -</option>
41                     {% for user in users %}
42                         <option {% if request.GET.user == user.username %}selected="selected"
43                             {% endif %}value="{% set_get_parameter user=user.username,page= %}">{{ user.first_name }} {{ user.last_name }} ({{ user.count }})</option>
44                     {% endfor %}
45                 </select></th>
46             {% endif %}
47
48         </tr></thead>
49
50         <tbody>
51         {% autopaginate books 100 %}
52         {% if not books %}
53             <tr><td>{% trans "No books found." %}</td></tr>
54         {% endif %}
55         {% for item in books %}
56             {% with item.book as book %}
57
58             {% ifequal item.book_length 1 %}
59                 {% with item.chunks.0 as chunk %}
60                 <tr>
61                     <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
62                     <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
63                     <td><a target="_blank"
64                                 href="{% url wiki_editor book.slug %}">
65                                 {{ book.title }}</a></td>
66                     <td>{% if chunk.stage %}
67                         ({{ chunk.stage }})
68                     {% else %}–
69                     {% endif %}</td>
70                     <td>{% if chunk.user %}<a href="{% url catalogue_user chunk.user.username %}">{{ chunk.user.first_name }} {{ chunk.user.last_name }}</a>{% endif %}</td>
71                 </tr>
72                 {% endwith %}
73             {% else %}
74                 <tr>
75                     <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
76                     <td></td>
77                     <td>{{ book.title }}</td>
78                 </tr>
79                 {% for chunk in item.chunks %}
80                     <tr>
81                         <td></td>
82                         <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
83                         <td><a target="_blank" href="{{ chunk.get_absolute_url }}">
84                                 <span class='chunkno'>{{ chunk.number }}.</span>
85                                 {{ chunk.comment }}</a></td>
86                         <td>{% if chunk.stage %}
87                                 {{ chunk.stage }}
88                             {% else %}
89                                 –
90                             {% endif %}</td>
91                         {% if not viewed_user %}
92                             <td>{% if chunk.user %}
93                                 <a href="{% url catalogue_user chunk.user.username %}">
94                                     {{ chunk.user.first_name }} {{ chunk.user.last_name }}
95                                 </a>{% else %}
96                                 
97                                 {% endif %}</td>
98                         {% endif %}
99                     </td></tr>
100                 {% endfor %}
101             {% endifequal %}
102             {% endwith %}
103         {% endfor %}
104         <tr><td colspan="3">{% paginate %}</td></tr>
105                 </tbody>
106     </table>
107         </form>
108 {% endblock leftcolumn %}
109
110 {% block rightcolumn %}
111         <div id="last-edited-list">
112                 <h2>{% trans "Your last edited documents" %}</h2>
113             <ol>
114                         {% for slugs, item in last_books %}
115                         <li><a href="{% url wiki_editor slugs.0 slugs.1 %}"
116                                 target="_blank">{{ item.title }}</a><br/><span class="date">({{ item.time|date:"H:i:s, d/m/Y" }})</span></li>
117                         {% endfor %}
118                 </ol>
119         </div>
120
121     {% if viewed_user %}
122         <h2>{% trans "Recent activity for" %} {{ viewed_user }}</h2>
123         {% wall viewed_user %}
124     {% else %}
125         <h2>{% trans "Recent activity" %}</h2>
126         {% wall %}
127     {% endif %}
128 {% endblock rightcolumn %}