add date_list; LogsPage; ListPage
This commit is contained in:
@ -34,7 +34,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% with list_paginator=paginator %}
|
||||
{% include "cms/list.html" %}
|
||||
{% include "cms/snippets/list.html" %}
|
||||
{% endwith %}
|
||||
{% endblock %}
|
||||
|
7
cms/templates/cms/logs_page.html
Normal file
7
cms/templates/cms/logs_page.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends "cms/base_site.html" %}
|
||||
{# generic page to display list of articles #}
|
||||
|
||||
{% block content %}
|
||||
{% include "cms/snippets/date_list.html" %}
|
||||
{% endblock %}
|
||||
|
@ -34,21 +34,21 @@
|
||||
|
||||
{% block page_nav_extras %}
|
||||
{% if page.program.active %}
|
||||
{% with object_list=page.next_diffs %}
|
||||
{% with object_list=page.next %}
|
||||
{% if object_list %}
|
||||
<div>
|
||||
<h2>{% trans "Next Diffusions" %}</h2>
|
||||
{% include "cms/list.html" %}
|
||||
{% include "cms/snippets/list.html" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endif %}{# program.active #}
|
||||
|
||||
{% with object_list=page.prev_diffs %}
|
||||
{% with object_list=page.prev %}
|
||||
{% if object_list %}
|
||||
<div>
|
||||
<h2>{% trans "Previous Diffusions" %}</h2>
|
||||
{% include "cms/list.html" %}
|
||||
{% include "cms/snippets/list.html" %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
@ -1,10 +0,0 @@
|
||||
{% extends "cms/base_site.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
|
||||
{% block title %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
37
cms/templates/cms/snippets/date_list.html
Normal file
37
cms/templates/cms/snippets/date_list.html
Normal file
@ -0,0 +1,37 @@
|
||||
{% load i18n %}
|
||||
|
||||
{# FIXME: get current complete URL #}
|
||||
<div class="list dated_list">
|
||||
{% if nav_dates %}
|
||||
<nav class="nav_dates">
|
||||
{% if nav_dates.prev %}
|
||||
<a href="?date={{ nav_dates.prev|date:"Y-m-d" }}" title="{% trans "previous days" %}"><</a>
|
||||
{% endif %}
|
||||
|
||||
{% for day in nav_dates.dates %}
|
||||
<a href="#day_{{day|date:"Y-m-d"}}"
|
||||
{% if day == nav_dates.date %}class="today"{% endif %}>
|
||||
{{ day|date:'D. d' }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
|
||||
{% if nav_dates.next %}
|
||||
<a href="?date={{ nav_dates.next|date:"Y-m-d" }}" title="{% trans "next days" %}">></a>
|
||||
{% endif %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
{% for day, list in object_list %}
|
||||
<ul id="day_{{day|date:"Y-m-d"}}"
|
||||
{% if day == nav_dates.date %}class="today"{% endif %}>
|
||||
{# you might like to hide it by default -- this more for sections #}
|
||||
<h2>{{ day|date:'l d F' }}</h2>
|
||||
{% with object_list=list list_date_format="H:i" %}
|
||||
{% for item in list %}
|
||||
{% include "cms/snippets/list_item.html" %}
|
||||
{% endfor %}
|
||||
{% endwith %}
|
||||
</ul>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
@ -1,9 +1,59 @@
|
||||
{% load i18n %}
|
||||
{% load aircox_cms %}
|
||||
|
||||
|
||||
<div class="list">
|
||||
<ul>
|
||||
{% for page in object_list %}
|
||||
{% with item=page.specific %}
|
||||
{% include "cms/snippets/list_item.html" %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{# we use list_paginator to avoid conflicts when there are multiple lists #}
|
||||
{% if list_paginator and list_paginator.num_pages > 1 %}
|
||||
<nav>
|
||||
{% with list_paginator.num_pages as num_pages %}
|
||||
{% if object_list.has_previous %}
|
||||
<a href="?page={{ object_list.previous_page_number }}">
|
||||
{% trans "previous page" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
|
||||
{% if object_list.number > 3 %}
|
||||
<a href="?page=1">1</a>
|
||||
{% if object_list.number > 4 %}
|
||||
…
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% for i in object_list.number|around:2 %}
|
||||
{% if i == object_list.number %}
|
||||
{{ object_list.number }}
|
||||
{% elif i > 0 and i <= num_pages %}
|
||||
<a href="?page={{ i }}">{{ i }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% with object_list.number|add:"2" as max %}
|
||||
{% if max < num_pages %}
|
||||
{% if max|add:"1" < num_pages %}
|
||||
…
|
||||
{% endif %}
|
||||
<a href="?page={{ num_pages }}">{{ num_pages }}</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
||||
{% if object_list.has_next %}
|
||||
<a href="?page={{ object_list.next_page_number }}">
|
||||
{% trans "next page" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
</nav>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
@ -1,15 +1,28 @@
|
||||
{% comment %}
|
||||
Configurable item to be put in a list. Support standard Publication or
|
||||
ListItem instance.
|
||||
|
||||
Options:
|
||||
* item: item to render. Fields: title, summary, cover, url, date, info, css_class
|
||||
* list_date_format: format passed to the date filter instead of default one
|
||||
{% endcomment %}
|
||||
|
||||
{% load wagtailimages_tags %}
|
||||
|
||||
<a {% if item.url %}href="{{ item.url }}" {% endif %}class="item page_item">
|
||||
<a {% if item.url %}href="{{ item.url }}" {% endif %}
|
||||
class="item page_item{% if item.css_class %}{{ item.css_class }}{% endif %}">
|
||||
{% image item.cover fill-64x64 class="cover item_cover" %}
|
||||
<h3>{{ item.title }}</h3>
|
||||
<div class="summary">{{ item.summary }}</div>
|
||||
{% if not item.show_in_menus %}
|
||||
{% if item.date %}
|
||||
{% if item.summary %}<div class="summary">{{ item.summary }}</div>{% endif %}
|
||||
{% if not item.show_in_menus and item.date %}
|
||||
{% with date_format=list_date_format|default:'l d F, H:i' %}
|
||||
<time datetime="{{ item.date }}">
|
||||
{{ item.date|date:'l d F, H:i' }}
|
||||
{{ item.date|date:date_format }}
|
||||
</time>
|
||||
{% endwith %}
|
||||
{% endif %}
|
||||
{% if item.info %}
|
||||
<span class="info">{{ item.info|safe }}</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
|
||||
|
Reference in New Issue
Block a user