Files
aircox-radiocampus/cms/templates/aircox/cms/list.html
2016-06-07 01:57:06 +02:00

124 lines
3.5 KiB
HTML

{% extends base_template %}
{% load i18n %}
{% load thumbnail %}
{% load aircox_cms %}
{% block content %}
<ul class="content">
{% for item in object_list %}
<li {% if item.css_class %}class="{{ item.css_class }}"{% endif %}
{% for k, v in item.attrs.items %}
{{ k }} = "{{ v|addslashes }}"
{% endfor %} >
{% if item.detail_url %}
<a href="{{ item.detail_url }}">
{% endif %}
{% if 'image' in list.fields and item.image %}
<img src="{% thumbnail item.image list.image_size crop %}">
{% endif %}
<div class="content">
{% if 'title' in list.fields and item.title %}
<h2 class="title">{{ item.title }}</h2>
{% endif %}
{% if 'content' in list.fields and item.content %}
<div class="text">
{% if list.truncate %}
{{ item.content|striptags|truncatewords:list.truncate }}
{% else %}
{{ item.content|striptags }}
{% endif %}
</div>
{% endif %}
</div>
<div class="meta">
{% if item.date and 'date' in list.fields or 'time' in list.fields %}
<time datetime="{{ item.date }}">
{% if 'date' in list.fields %}
<span class="date">
{{ item.date|date:'D. d F' }}
</span>
{% endif %}
{% if 'time' in list.fields %}
<span class="time">
{{ item.date|date:'H:i' }}
</span>
{% endif %}
</time>
{% endif %}
{% if item.author and 'author' in list.fields %}
<span class="author">
{{ item.author }}
</span>
{% endif %}
{% if item.info and 'info' in list.fields %}
<span class="info">
{{ item.info }}
</span>
{% endif %}
</div>
{% if item.detail_url %}
</a>
{% endif %}
{% empty %}
<div class="message empty">
{{ list.message_empty }}
</div>
{% endfor %}
</ul>
{% if object_list and not embed %}
{% if list.url or page_obj %}
<nav>
{% if not page_obj or embed %}
{% comment %}link to show more elements of the list{% endcomment %}
<a href="{{list.url}}">{% trans "&#8226;&#8226;&#8226;" %}</a>
{% elif page_obj.paginator.num_pages > 1 %}
{% with page_obj.paginator.num_pages as num_pages %}
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}">previous</a>
{% endif %}
{% if page_obj.number > 3 %}
<a href="?page=1">1</a>
{% if page_obj.number > 4 %}
&#8230;
{% endif %}
{% endif %}
{% for i in page_obj.number|around:2 %}
{% if i == page_obj.number %}
{{ page_obj.number }}
{% elif i > 0 and i <= num_pages %}
<a href="?page={{ i }}">{{ i }}</a>
{% endif %}
{% endfor %}
{% with page_obj.number|add:"2" as max %}
{% if max < num_pages %}
{% if max|add:"1" < num_pages %}
&#8230;
{% endif %}
<a href="?page={{ num_pages }}">{{ num_pages }}</a>
{% endif %}
{% endwith %}
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}">next</a>
{% endif %}
{% endwith %}
{% endif %}
</nav>
{% endif %}
{% endif %}
{% endblock %}