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