redesign default layout; add new sections type (Timetable, Logs, Search); fix multiple things & minors changes in some sections; new settings for referencing; new templates for date_list's items; etc

This commit is contained in:
bkfox
2016-07-25 22:31:00 +02:00
parent 960fcab65d
commit bce84af7f3
21 changed files with 630 additions and 249 deletions

View File

@ -10,6 +10,14 @@
<html>
<head>
<meta charset="utf-8">
<meta name="application-name" content="aircox-cms">
<meta name="description" content="{{ settings.cms.WebsiteSettings.description }}">
<meta name="keywords" content="{{ page.tags.all|default:settings.cms.WebsiteSettings.tags }}">
{% with favicon=settings.cms.WebsiteSettings.favicon %}
<link rel="icon" href="{{ favicon.url }}" />
{% endwith %}
{% block css %}
<link rel="stylesheet" href="{% static 'cms/css/layout.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'cms/css/theme.css' %}" type="text/css" />
@ -21,19 +29,19 @@
</head>
<body>
<div class="top">
<nav>
<a href="">Grille Horaire</a>
<a href="">Programmes</a>
<a href="">Contact</a>
</nav>
{% render_sections position="top" %}
</div>
<div class="middle">
<nav class="left">
{% render_sections position="menu_left" %}
<header class="header">
{% render_sections position="header" %}
</header>
<div class="page flex_row">
<nav class="page_left flex_item">
{% render_sections position="page_left" %}
</nav>
<main>
<main class="flex_item">
{% if messages %}
<ul class="messages">
{% for message in messages %}
@ -50,6 +58,14 @@
{% block content %}
{% endblock %}
</main>
<nav class="page_right flex_item">
{% render_sections position="page_right" %}
</nav>
</div>
<footer class="footer">
{% render_sections position="footer" %}
</footer>
</body>
</html>

View File

@ -1,8 +1,11 @@
{% extends "cms/base_site.html" %}
{% load i18n %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% load aircox_cms %}
{% block content %}
{% if object_list %}
{# list view #}
@ -18,75 +21,21 @@
{# detail view #}
<div class="content">
{% if page.cover %}
<img class="cover" src="{{ page.cover.file.url }}">
{% image page.cover max-600x480 class="cover" height="" width="" %}
{% endif %}
<div class="body">
<section class="body">
{{ page.body|richtext}}
{% block content_extras %}{% endblock %}
</section>
<div class="post_content">
{% render_sections position="post_content" %}
</div>
{% block content_extras %}
{% endblock %}
{% if page.related_links.all %}
<ul class="related">
<h3>{% trans "Related links" %}</h3>
{% for link in page.related_links.all %}
<li>
<a href="{{ link.url }}">
{% if link.icon %}{% image link.icon fill-size-32x32 %}{% endif %}
{{ link.title|default:link.url }}
</a>
</li>
{% endfor %}
</ul>
{% endif %}
<div class="comments">
<section class="comments">
{% include "cms/snippets/comments.html" %}
</div>
</section>
</div>
{% block page_nav %}
<nav class="page_nav">
{% block metadata %}
<div class="meta">
<div class="author">
{% if page.publish_as %}
{% with page.publish_as as item %}
{% include "cms/snippets/list_item.html" %}
{% endwith %}
{% else %}
{{ page.owner|default:'' }}
{% endif %}
</div>
<time datetime="{{ page.specific.date }}">
{% trans "Published on " %}
{{ page.specific.date|date:'l d F, H:i' }}
</time>
<div class="tags">
{% for tag in page.tags.all %}
{# <a href="{% pageurl page.blog_index %}?tag={{ tag }}">{{ tag }}</a> #}
{{ tag }}
{% endfor %}
</div>
</div>
{% endblock %}
{% block page_nav_extras %}
{% endblock %}
{% if page.recents %}
<div>
<h2>{% trans "Last Publications" %}</h2>
{% with object_list=page.recents %}
{% include "cms/snippets/list.html" %}
{% endwith %}
{# TODO: url to complete list of publications #}
</div>
{% endif %}
</nav>
{% endblock %}
{% endif %}
{% endblock %}

View File

@ -1,8 +1,8 @@
<div class="section_item {{ self.css_class }}">
<section class="section_item {{ self.css_class }}">
{% block title %}
{% if self.show_title %}<h2>{{ self.title }}</h2>{% endif %}
{% endblock %}
{% block content %}{{ content|safe }}{% endblock %}
</div>
</section>

View File

@ -4,7 +4,7 @@
{% block content %}
{% with link=self.as_dict %}
<a href="{{ link.url }}">
{% if link.icon %}{% image link.icon fill-32x32 class="icon" %}{% endif %}
{% if link.icon %}{% image link.icon fill-32x32 class="icon link_icon" height='' width='' %}{% endif %}
{{ link.text }}
</a>
{% endwith %}

View File

@ -6,7 +6,7 @@
{% with link=item.as_dict %}
<a href="{{ link.url }}"
{% if item.css_class %}class="{{ item.css_class }}"{% endif %}>
{% if link.icon %}{% image link.icon fill-32x32 class="icon" %}{% endif %}
{% if link.icon %}{% image link.icon fill-24x24 class="icon" %}{% endif %}
{{ link.text }}
</a>
{% endwith %}

View File

@ -0,0 +1,8 @@
{% extends "cms/sections/section_item.html" %}
{% block content %}
{% with item_date_format="H:i" list_css_class="date_list" %}
{% include "cms/snippets/list.html" %}
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,27 @@
{% extends "cms/sections/section_item.html" %}
{% load i18n %}
<div class="meta">
<div class="author">
{% if page.publish_as %}
{% trans "Published by" %}
{% with item=page.publish_as item_date_format='' %}
{% include "cms/snippets/list_item.html" %}
{% endwith %}
{% elif page.owner %}
{% trans "Published by" %}
{{ page.owner }}
{% endif %}
</div>
<time datetime="{{ page.specific.date }}">
{% trans "Published on " %}
{{ page.specific.date|date:'l d F, H:i' }}
</time>
<div class="tags">
{% for tag in page.tags.all %}
{# <a href="{% pageurl page.blog_index %}?tag={{ tag }}">{{ tag }}</a> #}
{{ tag }}
{% endfor %}
</div>
</div>

View File

@ -0,0 +1,10 @@
{% extends "cms/sections/section_item.html" %}
{% load i18n %}
{% block content %}
<form action="{{ list_page.url }}" method="GET">
<input type="text" name="search" placeholder="{{ self.text }}">
<input type="submit" style="display: none;">
</form>
{% endblock %}

View File

@ -0,0 +1,6 @@
{% extends "cms/sections/section_item.html" %}
{% block content %}
{% include "cms/snippets/date_list.html" %}
{% endblock %}

View File

@ -1,34 +1,58 @@
{% load i18n %}
<script>
/// Function used to select a panel on a tab selection.
/// The tab should be at max level -2 of the main container
/// The panel must have a class "panel"
function select_tab(target) {
parent = target.parentNode.parentNode;
var date = target.dataset.date;
panel = parent.querySelector('.panel[data-date="' + date + '"]');
// unselect
qs = parent.querySelectorAll('*[selected]');
for(var i = 0; i < qs.length; i++)
if(qs[i].dataset.date != date)
qs[i].removeAttribute('selected');
console.log(panel, target, date);
panel.setAttribute('selected', 'true');
target.setAttribute('selected', 'true');
}
</script>
{# FIXME: get current complete URL #}
<div class="list dated_list">
<div class="list date_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" %}">&lt;</a>
<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 %}>
<a onclick="select_tab(this);" data-date="day_{{day|date:"Y-m-d"}}"
{% if day == nav_dates.date %}selected{% endif %}
class="tab {% if day == nav_dates.date %}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" %}">&gt;</a>
<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 %}>
<ul class="panel {% if day == nav_dates.date %}class="today"{% endif %}"
{% if day == nav_dates.date %}selected{% endif %}
data-date="day_{{day|date:"Y-m-d"}}">
{# you might like to hide it by default -- this more for sections #}
<h2>{{ day|date:'l d F' }}</h2>
{% with object_list=list item_date_format="H:i" %}
{% for item in list %}
{% include "cms/snippets/list_item.html" %}
{% include "cms/snippets/date_list_item.html" %}
{% endfor %}
{% endwith %}
</ul>

View File

@ -0,0 +1,43 @@
{% comment %}
Configurable item to be put in a dated list. Work like list_item, the layout
is just a bit different.
{% endcomment %}
{% load wagtailimages_tags %}
<a {% if item.url %}href="{{ item.url }}" {% endif %}
class="list_item date_list_item {% if not item_big_cover %}flex_row {% endif %}{% if item.css_class %}{{ item.css_class }}{% endif %}">
{% if not item.show_in_menus and item.date and item_date_format != '' %}
{% with date_format=item_date_format|default_if_none:'l d F, H:i' %}
<time datetime="{{ item.date }}">
{{ item.date|date:date_format }}
</time>
{% endwith %}
{% endif %}
{% if item_big_cover %}
{% image item.cover max-640x480 class="cover big" height="" width="" %}
{% elif item.cover %}
{% image item.cover fill-64x64 class="cover small" %}
{% else %}
<div class="cover small"></div>
{% endif %}
<div class="flex_item">
<h3>{{ item.title }}</h3>
{% if item.summary %}<div class="summary">{{ item.summary }}</div>{% endif %}
{% if item.info %}
<span class="info">{{ item.info|safe }}</span>
{% endif %}
{% if item.extra %}
<div class="extra"></div>
{% endif %}
</div>
</a>

View File

@ -1,15 +1,19 @@
{% comment %}
Options:
- list_css_class: extra class for the main list container
- list_paginator: paginator object to display pagination at the bottom;
{% endcomment %}
{% load i18n %}
{% load aircox_cms %}
<div class="list">
<ul>
<ul class="list {{ list_css_class|default:'' }}">
{% 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 %}
@ -54,6 +58,6 @@
</nav>
{% endif %}
</div>
</ul>

View File

@ -4,30 +4,41 @@ ListItem instance.
Options:
* item: item to render. Fields: title, summary, cover, url, date, info, css_class
* item_date_format: format passed to the date filter instead of default one
* item_date_format: format passed to the date filter instead of default one. If
it is an empty string, do not print the date.
* item_big_cover: cover should is big instead of thumbnail (width: 600)
{% endcomment %}
{% load wagtailimages_tags %}
<a {% if item.url %}href="{{ item.url }}" {% endif %}
class="item page_item{% if item.css_class %}{{ item.css_class }}{% endif %}">
{% if item_big_cover %}
{% image item.cover max-600 class="cover item_cover" %}
{% else %}
{% image item.cover fill-64x64 class="cover item_cover" %}
class="list_item {% if not item_big_cover %}flex_row {% endif %}{% if item.css_class %}{{ item.css_class }}{% endif %}">
{% if item.cover %}
{% if item_big_cover %}
{% image item.cover max-640x480 class="cover big" height="" width="" %}
{% else %}
{% image item.cover fill-64x64 class="cover small" %}
{% endif %}
{% endif %}
<h3>{{ item.title }}</h3>
{% 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:date_format }}
</time>
{% endwith %}
{% endif %}
{% if item.info %}
<span class="info">{{ item.info|safe }}</span>
<div class="flex_item">
<h3>{{ item.title }}</h3>
{% if item.info %}
<span class="info">{{ item.info|safe }}</span>
{% endif %}
{% if item.summary %}<div class="summary">{{ item.summary }}</div>{% endif %}
{% if not item.show_in_menus and item.date and item_date_format != '' %}
{% with date_format=item_date_format|default_if_none:'l d F, H:i' %}
<time datetime="{{ item.date }}">
{{ item.date|date:date_format }}
</time>
{% endwith %}
{% endif %}
</div>
{% if item.extra %}
<div class="extra"></div>
{% endif %}
</a>