bec155605d4126e9800bf57709b1bf833ecd6186
[redakcja.git] / apps / wiki / templates / wiki / document_list.html
1 {% extends "wiki/base.html" %}
2
3 {% load i18n %}
4
5 {% block extrabody %}
6 {{ block.super }}
7 <script type="text/javascript" charset="utf-8">
8 $(function() {
9         function search(event) {
10         event.preventDefault();
11         var expr = new RegExp(slugify($('#file-list-filter').val()), 'i');
12         $('#file-list tbody tr').hide().filter(function(index) {
13             return expr.test(slugify( $('a', this).attr('data-id') ));
14         }).show();
15     }
16
17     $('#file-list-find-button').click(search).hide();
18         $('#file-list-filter').bind('keyup change DOMAttrModified', search);
19 });
20 </script>
21 {% endblock %}
22
23 {% block leftcolumn %}
24         <form method="get" action="#">
25     <table  id="file-list">
26         <thead>
27                 <tr><th>Filtr:</th>
28                         <th><input autocomplete="off" name="filter" id="file-list-filter" type="text" size="40" /></th>
29                         <th><input type="reset" value="{% trans "Clear filter" %}" id="file-list-reset-button"/></th>
30                         </tr>
31                 </thead>
32                 <tbody>
33         {% for book in books %}
34             <tr>
35                 <td><a target="_blank" data-id="{{ book.slug }}"
36                     href="{% url wiki_book book.slug %}">{{ book.title }}</a>
37                 </td>
38                 <td class='listitem-tools'>
39                     {% ifequal book.chunk_set.count 1 %}
40                         <a target="_blank" data-id="{{ book.slug }}"
41                                 href="{% url wiki_editor book.slug %}">
42                                 [{% trans "edit" %}]</a>
43                     {% else %}
44                         {% for chunk in book.chunk_set.all %}
45                             <a target="_blank" data-id="{{ book.slug }}"
46                                 href="{% url wiki_editor book.slug chunk.slug %}">
47                                 [<span class='chunkno'>{{ forloop.counter }}.</span>
48                                 {{ chunk.comment }}</a>]<br/>
49                         {% endfor %}
50                     {% endifequal %}
51                 </td>
52                                 <!-- placeholder </td> -->
53                         </tr>
54         {% endfor %}
55                 </tbody>
56     </table>
57         </form>
58 {% endblock leftcolumn %}
59
60 {% block rightcolumn %}
61         <div id="last-edited-list">
62                 <h2>{% trans "Your last edited documents" %}</h2>
63             <ol>
64                         {% for slugs, item in last_books %}
65                         <li><a href="{% url wiki_editor slugs.0 slugs.1 %}"
66                                 target="_blank">{{ item.title }}</a><br/><span class="date">({{ item.time|date:"H:i:s, d/m/Y" }})</span></li>
67                         {% endfor %}
68                 </ol>
69         </div>
70 {% endblock rightcolumn %}