30c3e27d1288a660bcc576641e33883f30e7d098
[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     $("select.filter").change(function() {
12         document.filter[this.name].value = this.value;
13         document.filter.submit();
14     });
15
16     $('#book-search').keypress(function(e)
17     {
18          if (e.which == 13) 
19          {
20             document.filter[this.name] = this.value;
21             document.filter.submit();
22          }
23     });
24
25 });
26 </script>
27 {% endblock %}
28
29 {% block leftcolumn %}
30
31     <form name='filter' action=''>
32     <input type='hidden' name="title" value="{{ request.GET.title }}" />
33     <input type='hidden' name="stage" value="{{ request.GET.stage }}" />
34     <input type='hidden' name="user" value="{{ request.GET.user }}" />
35     </form>
36
37     <table id="file-list">
38         <thead><tr>
39             <th></th>
40             <th></th>
41             <th id='th-book-search' style='width:300px;'>
42                 <form action='#'>
43                 <input name="title" class='filter' style='width:300px;' value="{{ request.GET.title }}" />
44                 </form>
45             </th>
46             <th><select name="stage" class="filter">
47                 <option value=''>- {% trans "filter by stage" %} -</option>
48                 <option {% if request.GET.stage == '-' %}selected="selected"
49                         {% endif %}value="-">- {% trans "none" %} -</option>
50                 {% for stage in stages %}
51                     <option {% if request.GET.stage == stage.slug %}selected="selected"
52                         {% endif %}value="{{ stage.slug }}">{{ stage.name }}</option>
53                 {% endfor %}
54             </select></th>
55
56             {% if not viewed_user %}
57                 <th><select name="user" class="filter">
58                     <option value=''>- {% trans "filter by user" %} -</option>
59                     <option {% if request.GET.user == '-' %}selected="selected"
60                             {% endif %}value="-">- {% trans "none" %} -</option>
61                     {% for user in users %}
62                         <option {% if request.GET.user == user.username %}selected="selected"
63                             {% endif %}value="{{ user.username }}">{{ user.first_name }} {{ user.last_name }} ({{ user.count }})</option>
64                     {% endfor %}
65                 </select></th>
66             {% endif %}
67
68         </tr></thead>
69
70         <tbody>
71         {% autopaginate books 100 %}
72         {% if not books %}
73             <tr><td>{% trans "No books found." %}</td></tr>
74         {% endif %}
75         {% for item in books %}
76             {% with item.book as book %}
77
78             {% ifequal item.book_length 1 %}
79                 {% with item.chunks.0 as chunk %}
80                 <tr>
81                     <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
82                     <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
83                     <td><a target="_blank"
84                                 href="{% url wiki_editor book.slug %}">
85                                 {{ book.title }}</a></td>
86                     <td>{% if chunk.stage %}
87                         ({{ chunk.stage }})
88                     {% else %}–
89                     {% endif %}</td>
90                     <td>{% if chunk.user %}<a href="{% url catalogue_user chunk.user.username %}">{{ chunk.user.first_name }} {{ chunk.user.last_name }}</a>{% endif %}</td>
91                 </tr>
92                 {% endwith %}
93             {% else %}
94                 <tr>
95                     <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
96                     <td></td>
97                     <td>{{ book.title }}</td>
98                 </tr>
99                 {% for chunk in item.chunks %}
100                     <tr>
101                         <td></td>
102                         <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
103                         <td><a target="_blank" href="{{ chunk.get_absolute_url }}">
104                                 <span class='chunkno'>{{ chunk.number }}.</span>
105                                 {{ chunk.comment }}</a></td>
106                         <td>{% if chunk.stage %}
107                                 {{ chunk.stage }}
108                             {% else %}
109                                 –
110                             {% endif %}</td>
111                         {% if not viewed_user %}
112                             <td>{% if chunk.user %}
113                                 <a href="{% url catalogue_user chunk.user.username %}">
114                                     {{ chunk.user.first_name }} {{ chunk.user.last_name }}
115                                 </a>{% else %}
116                                 
117                                 {% endif %}</td>
118                         {% endif %}
119                     </td></tr>
120                 {% endfor %}
121             {% endifequal %}
122             {% endwith %}
123         {% endfor %}
124         <tr><td colspan="3">{% paginate %}</td></tr>
125                 </tbody>
126     </table>
127 {% endblock leftcolumn %}
128
129 {% block rightcolumn %}
130         <div id="last-edited-list">
131                 <h2>{% trans "Your last edited documents" %}</h2>
132             <ol>
133                         {% for slugs, item in last_books %}
134                         <li><a href="{% url wiki_editor slugs.0 slugs.1 %}"
135                                 target="_blank">{{ item.title }}</a><br/><span class="date">({{ item.time|date:"H:i:s, d/m/Y" }})</span></li>
136                         {% endfor %}
137                 </ol>
138         </div>
139
140     {% if viewed_user %}
141         <h2>{% trans "Recent activity for" %} {{ viewed_user }}</h2>
142         {% wall viewed_user %}
143     {% else %}
144         <h2>{% trans "Recent activity" %}</h2>
145         {% wall %}
146     {% endif %}
147 {% endblock rightcolumn %}