ListPage as GenericPage; setting list_page; remove EventPage; pass context data in sections (to be able to retrieve settings; share buttons; tags with url

This commit is contained in:
bkfox
2016-08-10 15:55:40 +02:00
parent 021b2a116a
commit 1a6765b9b7
14 changed files with 267 additions and 175 deletions

View File

@ -44,7 +44,7 @@
{% render_sections position="page_left" %}
</nav>
<main class="flex_item">
<main class="flex_item {% if not object_list %}detail{% endif %}">
{% if messages %}
<ul class="messages">
{% for message in messages %}
@ -55,9 +55,12 @@
</ul>
{% endif %}
<header>
{% block title %}
<h1>{{ page.title }}</h1>
{% endblock %}
</header>
{% block content %}
{% endblock %}
</main>
@ -70,7 +73,7 @@
{% block footer %}
<footer class="footer">
{% render_sections position="footer" %}
<div class="small">Propulsed by
<div class="small float_right">Propulsed by
<a href="https://github.com/bkfox/aircox">Aircox</a>
</div>
</footer>

View File

@ -0,0 +1,61 @@
{% extends "cms/base_site.html" %}
{# generic page to display list of articles #}
{% load i18n %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% block title %}
<h1>
{# Translators: titles for the page that shows a list of elements. #}
{# Translators: terms are search terms, or tag tarms. url: url to the page #}
{% if page.list_from_request %}
{% with terms=list_selector.terms %}
{% if terms %}
{% blocktrans %}Search in publications for <i>{{ terms }}</i>{% endblocktrans %}
{% elif list_selector.filter_related %}
{# should never happen #}
{% with title=list_selector.filter_related.title url=list_selector.filter_related.url %}
{% blocktrans %}
Related to <a href="{{ url }}">{{ title }}</a>{% endblocktrans %}
{% endwith %}
{% else %}
{% blocktrans %}All the publications{% endblocktrans %}
{% endif %}
{% endwith %}
{% else %}
{{ page.title }}
{% endif %}
</h1>
{% endblock %}
{% block content %}
{% if page.list_from_request %}
{% with related=list_selector.filter_related %}
{% if related %}
<div class="body summary">
{% image related.cover fill-128x128 class="cover item_cover" %}
{{ related.summary }}
<a href="{{ related.url }}">{% trans "More about it" %}</a>
</div>
{% elif page.body %}
<div class="body">
{{ page.body|richtext }}
</div>
{% endif %}
{% endwith %}
{% with list_paginator=paginator %}
{% include "cms/snippets/list.html" %}
{% endwith %}
{% else %}
<div class="body">
{{ page.body|richtext }}
</div>
{% endif %}
{% endblock %}

View File

@ -1,49 +0,0 @@
{% extends "cms/base_site.html" %}
{# generic page to display list of articles #}
{% load i18n %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% block title %}
<h1>
{% with terms=list_selector.terms %}
{% if terms %}
{% blocktrans %}Search in publications for <i>{{ terms }}</i>{% endblocktrans %}
{% elif list_selector.filter_related %}
{# should never happen #}
{% with title=list_selector.filter_related.title url=list_selector.filter_related.url %}
{% blocktrans %}
Related to <a href="{{ url }}">{{ title }}</a>{% endblocktrans %}
{% endwith %}
{% else %}
{% blocktrans %}All the publications{% endblocktrans %}
{% endif %}
{% endwith %}
</h1>
{% endblock %}
{% block content %}
{% with related=list_selector.filter_related %}
{% if related %}
<div class="body summary">
{% image related.cover fill-128x128 class="cover item_cover" %}
{{ related.summary }}
<a href="{{ related.url }}">{% trans "More about it" %}</a>
</div>
{% elif page.body %}
<div class="body">
{{ page.body|richtext }}
</div>
{% endif %}
{% endwith %}
{% with list_paginator=paginator %}
{% include "cms/snippets/list.html" %}
{% endwith %}
{% endblock %}

View File

@ -8,10 +8,23 @@
{% if not object_list %}
{% block title %}
<h1 class="detail_title">{{ page.title }}</h1>
<h1 class="title">{{ page.title }}</h1>
{% if page.cover %}
{% image page.cover max-600x480 class="cover" height="" width="" %}
{% endif %}
<section class="summary">
{% if page.summary %}
{{ page.summary }}
{% else %}
{{ page.body|richtext|truncatewords:32 }}
{% endif %}
</section>
{% endblock %}
{% endif %}
{% block content %}
{% if object_list %}
{# list view #}
@ -25,25 +38,21 @@
{% endwith %}
{% else %}
{# detail view #}
{% if page.cover %}
{% image page.cover max-600x480 class="detail_cover cover" height="" width="" %}
{% endif %}
<div class="content">
<section class="body">
{{ page.body|richtext}}
</section>
<div class="content">
<section class="body">
{{ page.body|richtext}}
</section>
{% block content_extras %}{% endblock %}
{% block content_extras %}{% endblock %}
<div class="post_content">
{% render_sections position="post_content" %}
</div>
<section class="comments">
{% include "cms/snippets/comments.html" %}
</section>
<div class="post_content">
{% render_sections position="post_content" %}
</div>
<section class="comments">
{% include "cms/snippets/comments.html" %}
</section>
</div>
{% endif %}
{% endblock %}

View File

@ -1,11 +1,13 @@
{% extends "cms/sections/section_item.html" %}
{% load i18n %}
{% load static %}
{% load wagtailsettings_tags %}
{% block content %}
<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 %}
@ -14,15 +16,44 @@
{{ page.owner }}
{% endif %}
</div>
<time datetime="{{ page.specific.date }}">
{% trans "Published on " %}
{{ page.specific.date|date:'l d F, H:i' }}
{% with page_date=page.specific.date %}
{% if page_date %}
<time datetime="{{ page_date }}">
<b>{% trans "Published on " %}</b>
{{ page_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 %}
{% endif %}
{% endwith %}
{% with list_page=settings.cms.WebsiteSettings.list_page %}
{% if list_page %}
<div class="tags"><b>{% trans "Tags" %}</b>
{% for tag in page.tags.all %}
<a href="{{ list_page }}?tag={{ tag }}">{{ tag }}</a>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<div class="share">
<img src="{% static "cms/images/share.png" %}" alt="{% trans "Share" %}"
class="small_icon">
<a href="mailto:?&body={{ page.full_url|urlencode }}"
target="new">
<img src="{% static "cms/images/mail.png" %}" alt="Mail" class="small_icon">
</a>
<a href="https://www.facebook.com/sharer/sharer.php?u={{ page.full_url|urlencode }}"
target="new">
<img src="{% static "cms/images/facebook.png" %}" alt="Facebook" class="small_icon">
</a>
<a href="https://twitter.com/intent/tweet?text={{ page.full_url|urlencode }}"
target="new">
<img src="{% static "cms/images/twitter.png" %}" alt="Twitter" class="small_icon">
</a>
<a href="https://plus.google.com/share?url={{ page.full_url|urlencode }}"
target="new">
<img src="{% static "cms/images/gplus.png" %}" alt="Google Plus" class="small_icon">
</a>
</div>
</div>
{% endblock %}

View File

@ -2,11 +2,15 @@
{% load i18n %}
{% load static %}
{% load wagtailsettings_tags %}
{% block content %}
{% with list_page=settings.cms.WebsiteSettings.list_page %}
<form action="{{ list_page.url }}" method="GET">
<img src="{% static "cms/images/search.png" %}" class="icon"/>
<input type="text" name="search" placeholder="{{ self.default_text }}">
<input type="submit" style="display: none;">
</form>
{% endwith %}
{% endblock %}

View File

@ -29,7 +29,7 @@ Options:
{% 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' %}
{% with date_format=item_date_format|default:'l d F, H:i' %}
<time datetime="{{ item.date }}">
{{ item.date|date:date_format }}
</time>