Librarian in regular requirements.
[redakcja.git] / apps / catalogue / templates / catalogue / document_list.html
index 01e5a24..fe3598e 100644 (file)
 {% extends "catalogue/base.html" %}
 
 {% load i18n %}
-{% load pagination_tags %}
-{% load catalogue %}
+{% load catalogue book_list %}
+{% load pipeline %}
 
-{% block extrabody %}
-{{ block.super }}
-<script type="text/javascript" charset="utf-8">
-$(function() {
-    $("select.filter").change(function() {
-        document.filter[this.name].value = this.value;
-        document.filter.submit();
-    });
+{% block titleextra %}{% trans "Book list" %}{% endblock %}
 
-    $('#book-search').keypress(function(e)
-    {
-         if (e.which == 13) 
-         {
-            document.filter[this.name] = this.value;
-            document.filter.submit();
-         }
-    });
 
-});
-</script>
+{% block add_js %}
+{% javascript 'book_list' %}
 {% endblock %}
 
-{% block leftcolumn %}
-
-    <form name='filter' action=''>
-    <input type='hidden' name="title" value="{{ request.GET.title }}" />
-    <input type='hidden' name="stage" value="{{ request.GET.stage }}" />
-    <input type='hidden' name="user" value="{{ request.GET.user }}" />
-    </form>
-
-    <table id="file-list">
-        <thead><tr>
-            <th></th>
-            <th></th>
-            <th id='th-book-search' style='width:300px;'>
-                <form action='#'>
-                <input name="title" class='filter' style='width:300px;' value="{{ request.GET.title }}" />
-                </form>
-            </th>
-            <th><select name="stage" class="filter">
-                <option value=''>- {% trans "filter by stage" %} -</option>
-                <option {% if request.GET.stage == '-' %}selected="selected"
-                        {% endif %}value="-">- {% trans "none" %} -</option>
-                {% for stage in stages %}
-                    <option {% if request.GET.stage == stage.slug %}selected="selected"
-                        {% endif %}value="{{ stage.slug }}">{{ stage.name }}</option>
-                {% endfor %}
-            </select></th>
-
-            {% if not viewed_user %}
-                <th><select name="user" class="filter">
-                    <option value=''>- {% trans "filter by user" %} -</option>
-                    <option {% if request.GET.user == '-' %}selected="selected"
-                            {% endif %}value="-">- {% trans "none" %} -</option>
-                    {% for user in users %}
-                        <option {% if request.GET.user == user.username %}selected="selected"
-                            {% endif %}value="{{ user.username }}">{{ user.first_name }} {{ user.last_name }} ({{ user.count }})</option>
-                    {% endfor %}
-                </select></th>
-            {% endif %}
-
-        </tr></thead>
-
-        <tbody>
-        {% autopaginate books 100 %}
-        {% if not books %}
-            <tr><td>{% trans "No books found." %}</td></tr>
-        {% endif %}
-        {% for item in books %}
-            {% with item.book as book %}
-
-            {% ifequal item.book_length 1 %}
-                {% with item.chunks.0 as chunk %}
-                <tr>
-                    <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
-                    <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
-                    <td><a target="_blank"
-                                href="{% url wiki_editor book.slug %}">
-                                {{ book.title }}</a></td>
-                    <td>{% if chunk.stage %}
-                        ({{ chunk.stage }})
-                    {% else %}–
-                    {% endif %}</td>
-                    <td>{% if chunk.user %}<a href="{% url catalogue_user chunk.user.username %}">{{ chunk.user.first_name }} {{ chunk.user.last_name }}</a>{% endif %}</td>
-                </tr>
-                {% endwith %}
-            {% else %}
-                <tr>
-                    <td><a target="_blank" href="{% url catalogue_book book.slug %}">[B]</a></td>
-                    <td></td>
-                    <td>{{ book.title }}</td>
-                </tr>
-                {% for chunk in item.chunks %}
-                    <tr>
-                        <td></td>
-                        <td><a href="{% url catalogue_chunk_edit book.slug chunk.slug %}">[c]</a></td>
-                        <td><a target="_blank" href="{{ chunk.get_absolute_url }}">
-                                <span class='chunkno'>{{ chunk.number }}.</span>
-                                {{ chunk.title }}</a></td>
-                        <td>{% if chunk.stage %}
-                                {{ chunk.stage }}
-                            {% else %}
-                                –
-                            {% endif %}</td>
-                        {% if not viewed_user %}
-                            <td>{% if chunk.user %}
-                                <a href="{% url catalogue_user chunk.user.username %}">
-                                    {{ chunk.user.first_name }} {{ chunk.user.last_name }}
-                                </a>{% else %}
-                                
-                                {% endif %}</td>
-                        {% endif %}
-                    </td></tr>
-                {% endfor %}
-            {% endifequal %}
-            {% endwith %}
-       {% endfor %}
-        <tr><td colspan="3">{% paginate %}</td></tr>
-               </tbody>
-    </table>
-{% endblock leftcolumn %}
-
-{% block rightcolumn %}
-       <div id="last-edited-list">
-               <h2>{% trans "Your last edited documents" %}</h2>
-           <ol>
-                       {% for slugs, item in last_books %}
-                       <li><a href="{% url wiki_editor slugs.0 slugs.1 %}"
-                               target="_blank">{{ item.title }}</a><br/><span class="date">({{ item.time|date:"H:i:s, d/m/Y" }})</span></li>
-                       {% endfor %}
-               </ol>
-       </div>
+{% block add_css %}
+{% stylesheet 'book_list' %}
+{% endblock %}
 
-    {% if viewed_user %}
-        <h2>{% trans "Recent activity for" %} {{ viewed_user }}</h2>
-        {% wall viewed_user %}
-    {% else %}
-        <h2>{% trans "Recent activity" %}</h2>
-        {% wall %}
-    {% endif %}
-{% endblock rightcolumn %}
+{% block content %}
+    {% book_list %}
+{% endblock content %}