Fixed the list filter.
[redakcja.git] / apps / wiki / templates / wiki / document_list.html
1 {% extends "base.html" %}
2 {% load compressed %}
3
4 {% block extrahead %}
5 {% compressed_css 'listing' %}
6 {% endblock extrahead %}
7
8 {% block extrabody %}
9 {% compressed_js 'listing' %}
10 <script type="text/javascript" charset="utf-8">
11 $(function() {
12         function search(event) {
13         event.preventDefault();
14         
15         var expr = new RegExp(slugify($('#file-list-filter').val()), 'i');
16         
17         $('#file-list tbody tr').hide().filter(function(index) {
18             console.log(expr.test($(this).attr('title')))
19             return expr.test(slugify($('a', this).html()));
20         }).show();
21     }
22         
23     $('#file-list-find-button').click(search).hide();
24         $('#file-list-filter').bind('keyup change DOMAttrModified', search);
25 });
26 </script>
27 {% endblock %}
28
29 {% block maincontent %}
30 <h1><img src="{{STATIC_URL}}/img/logo.png">Platforma Redakcyjna</h1>
31
32 <div id="document-list">         
33     <table id="file-list">
34         <thead><tr><th colspan="2">
35         <form action="#" method="GET">
36         Filtr: <input autocomplete="off" name="filter" id="file-list-filter" type="text" size="60" />
37                 <input type="submit" value="Znajdź" id="file-list-find-button"/>
38                 <input type="reset" value="Wyczyść" id="file-list-reset-button"/>
39         
40         </form>
41                 </th></tr></thead>              
42                 <tbody>
43         {% for file in document_list %}
44             <tr>
45                 <td><a target="_blank" href="{% url wiki.views.document_detail file|urlencode %}">{{ file }}</a></td>
46                                 <td><!-- placeholder --></td>
47                         </tr>
48         {% endfor %}
49                 </tbody>
50     </table>
51         
52         <div id="last-edited-list">
53                 <h2>Twoje ostatnio otwierane dokumenty:</h2>
54                 <ol>
55                         {% for   name, date in last_docs %}
56                         <li><a href="{% url wiki.views.document_detail name|urlencode %}"
57                                 target="_blank">{{ name }}</a><br/><span class="date">({{ date|date:"H:i:s, d/m/Y" }})</span></li>
58                         {% endfor %}                    
59                 </ol>
60         </div>
61 </div>
62
63 </div>
64 {% endblock maincontent %}