sections rendering + make view for existing section's items

This commit is contained in:
bkfox
2016-07-24 19:49:15 +02:00
parent 5ab731e866
commit 90021bc9f0
13 changed files with 395 additions and 94 deletions

View File

@ -1,7 +1,11 @@
{% load staticfiles %}
{% load i18n %}
{% load wagtailimages_tags %}
{% load wagtailsettings_tags %}
{% load aircox_cms %}
{% get_settings %}
<html>
@ -26,7 +30,7 @@
<div class="middle">
<nav class="left">
<img src="{{ settings.cms.WebsiteSettings.logo.file.url }}" class="logo">
{% render_sections position="menu_left" %}
</nav>
<main>

View File

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

View File

@ -0,0 +1,13 @@
{% extends "cms/sections/section_item.html" %}
{% load wagtailimages_tags %}
{% block content %}
{% with link=self.as_dict %}
<a href="{{ link.url }}">
{% if link.icon %}{% image link.icon fill-32x32 class="icon" %}{% endif %}
{{ link.text }}
</a>
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends "cms/sections/section_item.html" %}
{% load wagtailimages_tags %}
{% block content %}
{% for item in object_list %}
{% 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 %}
{{ link.text }}
</a>
{% endwith %}
{% endfor %}
{% endblock %}

View File

@ -0,0 +1,17 @@
{% extends "cms/sections/section_item.html" %}
{% block content %}
{% if focus %}
{% with item=focus item_big_cover=True %}
{% include "cms/snippets/list_item.html" %}
{% endwith %}
{% endif %}
{% include "cms/snippets/list.html" %}
{% if url %}
<nav><a href="{{ url }}">{{ self.url_text }}</nav>
{% endif %}
{% endblock %}

View File

@ -26,7 +26,7 @@
{% 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" %}
{% with object_list=list item_date_format="H:i" %}
{% for item in list %}
{% include "cms/snippets/list_item.html" %}
{% endfor %}

View File

@ -4,14 +4,19 @@ 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
* item_date_format: format passed to the date filter instead of default one
* 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 %}">
{% image item.cover fill-64x64 class="cover item_cover" %}
{% if item_big_cover %}
{% image item.cover max-600 class="cover item_cover" %}
{% else %}
{% image item.cover fill-64x64 class="cover item_cover" %}
{% endif %}
<h3>{{ item.title }}</h3>
{% if item.summary %}<div class="summary">{{ item.summary }}</div>{% endif %}
{% if not item.show_in_menus and item.date %}