Projet

Général

Profil

Télécharger (3,09 ko) Statistiques
| Branche: | Tag: | Révision:

root / corbo / templates / corbo / manage.html @ f38ae358

1
{% extends 'corbo/base.html' %}
2
{% load i18n static %}
3
{% block page-title %}
4
{{ block.super }} :: {% trans "Management" %}
5
{% endblock %}
6

    
7

    
8

    
9
{% block content %}
10
<div class="categories">
11
  <span class="title">{% trans "Category:" %}</span>
12
  <select>
13
    <option value=''>{% trans "All" %}</option>
14
    {% for category in categories %}
15
    <option value='{{ category.id }}'{% if category_id == category.id %} selected{% endif %}>{{ category }}</option>
16
    {% endfor %}
17
  </select>
18
  <span>
19
    {% if category_id %}
20
    <a class="icon edit" href="{% url "edit_category" category_id %}" rel="popup" title="{% trans "edit category" %}"></a>
21
    <a class="icon delete" href="{% url "delete_category" category_id %}" rel="popup" title="{% trans "delete category" %}"></a>
22
    {% endif %}
23
    <a class="icon add" href="{% url "add_category" %}" rel="popup" title="{% trans "add category" %}"></a></span>
24
</div>
25
<div id="management">
26
  <h4>{% trans "Announces" %}</h4>
27
  <span><a class="icon add" href="{% url "add_announce" %}" rel="popup">{% trans "add announce" %}</a></span>
28
<ul>
29
{% for obj in object_list %}
30
<li class='{% cycle 'bluesky' '' %}'>
31
  <div class="status">
32
    {% if obj.is_published %}
33
    <span class="icon published" title="{% trans "published" %}"></span>
34
    {% endif %}
35
    {% if not obj.is_published %}
36
    {% if obj.is_expired %}
37
    <span class="icon expired" title="{% trans "expired" %}"></span>
38
    {% else %}
39
    <span class="icon unpublished" title="{% trans "not published yet" %}"></span>
40
    {% endif %}
41
    {% endif %}
42
  </div>
43
  <div class="preview datetime">
44
    {% blocktrans with mtime=obj.mtime|date:'DATETIME_FORMAT' %}
45
    Modified on {{ mtime }}
46
    {% endblocktrans %}
47
  </div>
48
  <div class="actions">
49
    <span><a class="icon edit" href="{% url 'edit_announce' obj.id %}" rel="popup"></a></span>
50
    <span><a class="icon delete" href="{% url 'delete_announce' obj.id %}" rel="popup"></a></span>
51
  </div>
52
  <div class="announce">
53
    <div class="title">{{ obj.title }}</div>
54
    <div class="preview">{{ obj.text|safe|truncatechars_html:128 }}</div>
55
  </div>
56
</li>
57
{% empty %}
58
<div class="empty">
59
  {% trans "No announces matching this category" %}
60
</div>
61
{% endfor %}
62
</ul>
63

    
64
{% if is_paginated %}
65
<ul class="pagination">
66
  {% if page_obj.has_previous %}
67
  <li class="prev">
68
    <a href="?{% if category_id %}category={{ category_id}}&{% endif %}page={{ page_obj.previous_page_number }}" class="icon"></a>
69
  </li>
70
  {% endif %}
71
  <li class="current">
72
    page {{ page_obj.number }} of {{ paginator.num_pages }}
73
  </li>
74
  {% if page_obj.has_next %}
75
  <li class="next">
76
    <a href="?{% if category_id %}category={{ category_id}}&{% endif %}page={{ page_obj.next_page_number }}" class="icon"></a>
77
  </li>
78
  {% endif %}
79
</ul>
80
{% endif %}
81
</div>
82
{% endblock %}
83

    
84
{% block page-end %}
85
<script type="text/javascript">
86
  $(function() {
87
    $('div.categories select').on('change', function() {
88
        var category = $(this).val();
89
        if (category)
90
            window.location.replace('{% url "manage" %}?category=' + category);
91
        else
92
            window.location.replace({% url "manage" %});
93
    })
94
})
95
</script>
96
{% endblock %}
(7-7/7)