Projet

Général

Profil

Télécharger (2,64 ko) Statistiques
| Branche: | Tag: | Révision:

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

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><a class="icon add" href="{% url "add_category" %}" rel="popup">{% trans "add category" %}</a></span>
19
</div>
20
<div id="management">
21
  <h4>{% trans "Announces" %}</h4>
22
  <span><a class="icon add" href="{% url "add_announce" %}" rel="popup">{% trans "add announce" %}</a></span>
23
<ul>
24
{% for obj in object_list %}
25
<li class='{% cycle 'bluesky' '' %}'>
26
  <div class="status">
27
    {% if obj.is_published %}
28
    <span class="icon published" title="{% trans "published" %}"></span>
29
    {% endif %}
30
    {% if not obj.is_published %}
31
    {% if obj.is_expired %}
32
    <span class="icon expired" title="{% trans "expired" %}"></span>
33
    {% else %}
34
    <span class="icon unpublished" title="{% trans "not published yet" %}"></span>
35
    {% endif %}
36
    {% endif %}
37
  </div>
38
  <div class="actions">
39
    <span><a class="icon edit" href="{% url 'edit_announce' obj.id %}" rel="popup"></a></span>
40
    <span><a class="icon delete" href="{% url 'delete_announce' obj.id %}" rel="popup"></a></span>
41
  </div>
42
  <div class="announce">
43
    <div class="title">{{ obj.title }}</div>
44
    <div class="text_preview">{{ obj.text|safe|truncatechars_html:128 }}</div>
45
  </div>
46
</li>
47
{% empty %}
48
<div class="empty">
49
  {% trans "No announces matching this category" %}
50
</div>
51
{% endfor %}
52
</ul>
53

    
54
{% if is_paginated %}
55
<ul class="pagination">
56
  {% if page_obj.has_previous %}
57
  <li class="prev">
58
    <a href="?{% if category_id %}category={{ category_id}}&{% endif %}page={{ page_obj.previous_page_number }}" class="icon"></a>
59
  </li>
60
  {% endif %}
61
  <li class="current">
62
    page {{ page_obj.number }} of {{ paginator.num_pages }}
63
  </li>
64
  {% if page_obj.has_next %}
65
  <li class="next">
66
    <a href="?{% if category_id %}category={{ category_id}}&{% endif %}page={{ page_obj.next_page_number }}" class="icon"></a>
67
  </li>
68
  {% endif %}
69
</ul>
70
{% endif %}
71
</div>
72
{% endblock %}
73

    
74
{% block page-end %}
75
<script type="text/javascript">
76
  $(function() {
77
    $('div.categories select').on('change', function() {
78
        var category = $(this).val();
79
        if (category)
80
            window.location.replace('{% url "manage" %}?category=' + category);
81
        else
82
            window.location.replace({% url "manage" %});
83
    })
84
})
85
</script>
86
{% endblock %}
(5-5/5)