Project

General

Profile

Download (3.09 KB) Statistics
| Branch: | Tag: | Revision:
{% extends 'corbo/base.html' %}
{% load i18n static %}
{% block page-title %}
{{ block.super }} :: {% trans "Management" %}
{% endblock %}



{% block content %}
<div class="categories">
<span class="title">{% trans "Category:" %}</span>
<select>
<option value=''>{% trans "All" %}</option>
{% for category in categories %}
<option value='{{ category.id }}'{% if category_id == category.id %} selected{% endif %}>{{ category }}</option>
{% endfor %}
</select>
<span>
{% if category_id %}
<a class="icon edit" href="{% url "edit_category" category_id %}" rel="popup" title="{% trans "edit category" %}"></a>
<a class="icon delete" href="{% url "delete_category" category_id %}" rel="popup" title="{% trans "delete category" %}"></a>
{% endif %}
<a class="icon add" href="{% url "add_category" %}" rel="popup" title="{% trans "add category" %}"></a></span>
</div>
<div id="management">
<h4>{% trans "Announces" %}</h4>
<span><a class="icon add" href="{% url "add_announce" %}" rel="popup">{% trans "add announce" %}</a></span>
<ul>
{% for obj in object_list %}
<li class='{% cycle 'bluesky' '' %}'>
<div class="status">
{% if obj.is_published %}
<span class="icon published" title="{% trans "published" %}"></span>
{% endif %}
{% if not obj.is_published %}
{% if obj.is_expired %}
<span class="icon expired" title="{% trans "expired" %}"></span>
{% else %}
<span class="icon unpublished" title="{% trans "not published yet" %}"></span>
{% endif %}
{% endif %}
</div>
<div class="preview datetime">
{% blocktrans with mtime=obj.mtime|date:'DATETIME_FORMAT' %}
Modified on {{ mtime }}
{% endblocktrans %}
</div>
<div class="actions">
<span><a class="icon edit" href="{% url 'edit_announce' obj.id %}" rel="popup"></a></span>
<span><a class="icon delete" href="{% url 'delete_announce' obj.id %}" rel="popup"></a></span>
</div>
<div class="announce">
<div class="title">{{ obj.title }}</div>
<div class="preview">{{ obj.text|safe|truncatechars_html:128 }}</div>
</div>
</li>
{% empty %}
<div class="empty">
{% trans "No announces matching this category" %}
</div>
{% endfor %}
</ul>

{% if is_paginated %}
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="prev">
<a href="?{% if category_id %}category={{ category_id}}&{% endif %}page={{ page_obj.previous_page_number }}" class="icon"></a>
</li>
{% endif %}
<li class="current">
page {{ page_obj.number }} of {{ paginator.num_pages }}
</li>
{% if page_obj.has_next %}
<li class="next">
<a href="?{% if category_id %}category={{ category_id}}&{% endif %}page={{ page_obj.next_page_number }}" class="icon"></a>
</li>
{% endif %}
</ul>
{% endif %}
</div>
{% endblock %}

{% block page-end %}
<script type="text/javascript">
$(function() {
$('div.categories select').on('change', function() {
var category = $(this).val();
if (category)
window.location.replace('{% url "manage" %}?category=' + category);
else
window.location.replace({% url "manage" %});
})
})
</script>
{% endblock %}
(7-7/10)