Projet

Général

Profil

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

root / corbo / templates / corbo / manage.html @ 98bf28f8

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="preview datetime">
39
    {% blocktrans with mtime=obj.mtime|date:'DATETIME_FORMAT' %}
40
    Modified on {{ mtime }}
41
    {% endblocktrans %}
42
  </div>
43
  <div class="actions">
44
    <span><a class="icon edit" href="{% url 'edit_announce' obj.id %}" rel="popup"></a></span>
45
    <span><a class="icon delete" href="{% url 'delete_announce' obj.id %}" rel="popup"></a></span>
46
  </div>
47
  <div class="announce">
48
    <div class="title">{{ obj.title }}</div>
49
    <div class="preview">{{ obj.text|safe|truncatechars_html:128 }}</div>
50
  </div>
51
</li>
52
{% empty %}
53
<div class="empty">
54
  {% trans "No announces matching this category" %}
55
</div>
56
{% endfor %}
57
</ul>
58

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

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