page templates & views reordering

This commit is contained in:
bkfox
2020-09-22 00:51:00 +02:00
parent 5a17d034c4
commit ea17141321
13 changed files with 172 additions and 145 deletions

View File

@ -10,21 +10,6 @@ Usefull context:
- sidebar_object_list: item to display in sidebar
- sidebar_url_name: url name sidebar item complete list
- sidebar_url_parent: parent page for sidebar items complete list
Blocks:
- assets
- head_title
- head_extra
- top_nav
- header:
- title
- subtitle
- header_meta
- main:
- filters
- cover
- sidebar:
- sidebar_title
{% endcomment %}
{% load static i18n thumbnail aircox %}
@ -112,6 +97,7 @@ Blocks:
{% endif %}
{% endblock %}
{# TODO: change block name #}
{% if has_filters %}
{% comment %}Translators: extra toolbar displayed on the top of page lists {% endcomment %}
<nav class="navbar toolbar"

View File

@ -1,8 +1,5 @@
{% extends "aircox/base.html" %}
{% comment %}
This template is only used in order to have correct page <title></title>,
otherwise use base.html
{% endcomment %}
{% comment %}Display detail of a BasePage{% endcomment %}
{% block head_title %}
{% block title %}{{ page.title }}{% endblock %}

View File

@ -0,0 +1,85 @@
{% extends "aircox/base.html" %}
{% comment %}Display a list of BasePages{% endcomment %}
{% load i18n aircox %}
{% block head_title %}
{% block title %}
{% if not page or not page.title %}
{% if not parent %}{{ view.model|verbose_name:True|title }}
{% else %}
{% with parent.title as title %}
{% with model|default:"Publications"|verbose_name:True|capfirst as model %}
{% comment %}Translators: title when pages are filtered for a specific parent page, e.g.: Articles of My Incredible Show{% endcomment %}
{% blocktrans %}{{ model }} of {{ title }}{% endblocktrans %}
{% endwith %}
{% endwith %}
{% endif %}
{% else %}{{ block.super }}
{% endif %}
{% endblock %}
&mdash;
{{ station.name }}
{% endblock %}
{% block main %}{{ block.super }}
<section role="list">
{% block pages_list %}
{% with has_headline=True %}
{% for object in object_list %}
{% block list_object %}
{% include object.item_template_name|default:item_template_name %}
{% endblock %}
{% empty %}
{% blocktrans %}There is nothing published here...{% endblocktrans %}
{% endfor %}
{% endwith %}
{% endblock %}
</section>
{% if is_paginated %}
<hr/>
{% update_query request.GET.copy page=None as GET %}
{% with GET.urlencode as GET %}
<nav class="pagination is-centered" role="pagination" aria-label="{% trans "pagination" %}">
{% block pagination %}
{% if page_obj.has_previous %}
<a href="?{{ GET }}&page={{ page_obj.previous_page_number }}" class="pagination-previous">
{% else %}
<a class="pagination-previous" disabled>
{% endif %}
{% comment %}Translators: Bottom of the list, "previous page"{% endcomment %}
{% trans "Previous" %}</a>
{% if page_obj.has_next %}
<a href="?{{ GET }}&page={{ page_obj.next_page_number }}" class="pagination-next">
{% else %}
<a class="pagination-next" disabled>
{% endif %}
{% comment %}Translators: Bottom of the list, "Nextpage"{% endcomment %}
{% trans "Next" %}</a>
<ul class="pagination-list">
{% for i in paginator.page_range %}
<li>
{% comment %}
<form action="?{{ GET }}">
{% for get in GET %}
<input type="hidden" name="{{ get.0 }}" value="{{ get.1 }}" />
{% endfor %}
<input type="number" name="page" value="{{ page_obj.number }}" />
</form>
{% endcomment %}
<a class="pagination-link {% if page_obj.number == i %}is-current{% endif %}"
href="?{{ GET }}&page={{ i }}">{{ i }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}
</nav>
{% endwith %}
{% endif %}
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "aircox/page.html" %}
{% extends "aircox/page_list.html" %}
{% comment %}List of diffusions as a timetable{% endcomment %}
{% load i18n aircox humanize %}
@ -20,7 +20,7 @@
{% endwith %}
{% endblock %}
{% block main %}{{ block.super }}
{% block pages_list %}
{% with hide_schedule=True %}
<section role="list">
<div id="timetable-{{ date|date:"Y-m-d" }}">
@ -41,11 +41,5 @@
</div>
</section>
{% endwith %}
{% comment %}
<nav class="column menu is-one-third-desktop" role="menu">
</nav>
{% endcomment %}
{% endblock %}

View File

@ -1,4 +1,5 @@
{% extends "aircox/page_list.html" %}
{% comment %}Home page{% endcomment %}
{% load i18n %}
{% block head_title %}{{ station.name }}{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "aircox/page.html" %}
{% extends "aircox/page_list.html" %}
{% comment %}List of logs for a specific date{% endcomment %}
{% load i18n humanize aircox %}
@ -21,7 +21,7 @@
{% endwith %}
{% endblock %}
{% block main %}{{ block.super }}
{% block pages_list %}
<section>
{# <h4 class="subtitle size-4">{{ date }}</h4> #}
{% include "aircox/widgets/log_list.html" %}

View File

@ -1,10 +1,9 @@
{% extends "aircox/page.html" %}
{% extends "aircox/basepage.html" %}
{% load static i18n humanize honeypot %}
{% comment %}
Base template used to display a page
Base template used to display a Page
Context:
- title: title
- page: page
{% endcomment %}

View File

@ -1,22 +1,7 @@
{% extends "aircox/page.html" %}
{% comment %}Display a list of pages{% endcomment %}
{% extends "aircox/basepage_list.html" %}
{% comment %}Display a list of Pages{% endcomment %}
{% load i18n aircox %}
{% block title %}
{% if not page or not page.title %}
{% if not parent %}{{ view.model|verbose_name:True|title }}
{% else %}
{% with parent.title as title %}
{% with model|default:"Publications"|verbose_name:True|capfirst as model %}
{% comment %}Translators: title when pages are filtered for a specific parent page, e.g.: Articles of My Incredible Show{% endcomment %}
{% blocktrans %}{{ model }} of {{ title }}{% endblocktrans %}
{% endwith %}
{% endwith %}
{% endif %}
{% else %}{{ block.super }}
{% endif %}
{% endblock %}
{% block filters %}
{# FIXME #}
{% if filter_categories %}
@ -63,56 +48,3 @@
{% endblock %}
{% block main %}{{ block.super }}
<section role="list">
{% block pages_list %}
{% with has_headline=True %}
{% for object in object_list %}
{% block list_object %}
{% include object.item_template_name|default:item_template_name %}
{% endblock %}
{% empty %}
{% blocktrans %}There is nothing published here...{% endblocktrans %}
{% endfor %}
{% endwith %}
{% endblock %}
</section>
{% if is_paginated %}
<hr/>
{% update_query request.GET.copy page=None as GET %}
{% with GET.urlencode as GET %}
<nav class="pagination is-centered" role="pagination" aria-label="{% trans "pagination" %}">
{% block pagination %}
{% if page_obj.has_previous %}
<a href="?{{ GET }}&page={{ page_obj.previous_page_number }}" class="pagination-previous">
{% else %}
<a class="pagination-previous" disabled>
{% endif %}
{% comment %}Translators: Bottom of the list, "previous page"{% endcomment %}
{% trans "Previous" %}</a>
{% if page_obj.has_next %}
<a href="?{{ GET }}&page={{ page_obj.next_page_number }}" class="pagination-next">
{% else %}
<a class="pagination-next" disabled>
{% endif %}
{% comment %}Translators: Bottom of the list, "Nextpage"{% endcomment %}
{% trans "Next" %}</a>
<ul class="pagination-list">
{% for i in paginator.page_range %}
<li>
<a class="pagination-link {% if page_obj.number == i %}is-current{% endif %}"
href="?{{ GET }}&page={{ i }}">{{ i }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}
</nav>
{% endwith %}
{% endif %}
{% endblock %}