remove old cms, switch to wagtail; move website to cms

This commit is contained in:
bkfox
2016-07-22 05:50:00 +02:00
parent 4bbffa9a50
commit ba3bf68e33
50 changed files with 950 additions and 4836 deletions

View File

@ -1,32 +0,0 @@
{% extends "aircox/cms/website.html" %}
{% block header %}
{% spaceless %}
<header>
<a href="{% url exp.name key="render" year=prev_month.year month=prev_month.month %}"
onclick="return Section.load_event(event);">&lt;</a>
<h3>{{ this_month|date:'F Y' }}</h3>
<a href="{% url exp.name key="render" year=next_month.year month=next_month.month %}"
onclick="return Section.load_event(event);">&gt;</a>
</header>
{% endspaceless %}
{% endblock %}
{% block content %}
{% spaceless %}
<div class="content">
<div first_weekday="{{ first_weekday }}">&nbsp;</div>
{% for day, url in days %}
{% if day == today %}
<a href="{{ url }}" weekday="{{ day.weekday }}" class="today">{{ day.day }}</a>
{% else %}
<a href="{{ url }}" weekday="{{ day.weekday }}">{{ day.day }}</a>
{% endif %}
{% endfor %}
</div>
{% endspaceless %}
{% endblock %}

View File

@ -1,29 +0,0 @@
{% extends "aircox/cms/website.html" %}
{% load aircox_cms %}
{% block header %}
<header>
{% if object.thread %}
<div class="threads">
{{ object|threads:' > '|safe }}
</div>
{% endif %}
<time datetime="{{ object.date }}">
{{ object.date|date:'l d F Y' }},
{{ object.date|time:'H\hi' }}
</time>
{% if object.tags.all %}
<div class="tags">
{{ object|post_tags:' - '|safe }}
</div>
{% endif %}
</header>
{% endblock %}
{% block content %}
{{ content|safe }}
{% endblock %}

View File

@ -1,64 +0,0 @@
{% extends "aircox/cms/website.html" %}
{% load i18n %}
{% load thumbnail %}
{% load aircox_cms %}
{% block content %}
<ul class="content">
{% for object in object_list %}
{% include "aircox/cms/list_item.html" %}
{% empty %}
<div class="message empty">
{{ list.message_empty }}
</div>
{% endfor %}
</ul>
{% if object_list and not embed %}
{% if list.url or page_obj %}
<nav>
{% if not page_obj or embed %}
{% comment %}link to show more elements of the list{% endcomment %}
<a href="{{list.url}}">{% trans "&#8226;&#8226;&#8226;" %}</a>
{% elif page_obj.paginator.num_pages > 1 %}
{% with page_obj.paginator.num_pages as num_pages %}
{% if page_obj.has_previous %}
<a href="?page={{ page_obj.previous_page_number }}">previous</a>
{% endif %}
{% if page_obj.number > 3 %}
<a href="?page=1">1</a>
{% if page_obj.number > 4 %}
&#8230;
{% endif %}
{% endif %}
{% for i in page_obj.number|around:2 %}
{% if i == page_obj.number %}
{{ page_obj.number }}
{% elif i > 0 and i <= num_pages %}
<a href="?page={{ i }}">{{ i }}</a>
{% endif %}
{% endfor %}
{% with page_obj.number|add:"2" as max %}
{% if max < num_pages %}
{% if max|add:"1" < num_pages %}
&#8230;
{% endif %}
<a href="?page={{ num_pages }}">{{ num_pages }}</a>
{% endif %}
{% endwith %}
{% if page_obj.has_next %}
<a href="?page={{ page_obj.next_page_number }}">next</a>
{% endif %}
{% endwith %}
{% endif %}
</nav>
{% endif %}
{% endif %}
{% endblock %}

View File

@ -1,74 +0,0 @@
{% load i18n %}
{% load thumbnail %}
{% load aircox_cms %}
{% with object|downcast as object %}
<li {% if object.css_class %}class="{{ object.css_class }}"{% endif %}
{% for k, v in object.attrs.items %}
{{ k }} = "{{ v|addslashes }}"
{% endfor %} >
{% if object.url %}
<a class="url" href="{{ object.url }}">
{% endif %}
{% if 'image' in list.fields and object.image %}
<img class="image" src="{% thumbnail object.image list.image_size crop %}">
{% endif %}
<div class="body">
{% if 'title' in list.fields and object.title %}
<h2 class="title">{{ object.title }}</h2>
{% endif %}
{% if 'content' in list.fields and object.content %}
<div class="content">
{% if list.truncate %}
{{ object.content|striptags|truncatewords:list.truncate }}
{% else %}
{{ object.content|striptags }}
{% endif %}
</div>
{% endif %}
</div>
<div class="meta">
{% if object.date and 'date' in list.fields or 'time' in list.fields %}
<time datetime="{{ object.date }}">
{% if 'date' in list.fields %}
<span class="date">
{{ object.date|date:'D. d F' }}
</span>
{% endif %}
{% if 'time' in list.fields %}
<span class="time">
{{ object.date|date:'H:i' }}
</span>
{% endif %}
</time>
{% endif %}
{% if object.author and 'author' in list.fields %}
<span class="author">
{{ object.author }}
</span>
{% endif %}
{% if object.info and 'info' in list.fields %}
<span class="info">
{{ object.info }}
</span>
{% endif %}
</div>
{% if object.actions and 'actions' in list.fields %}
<div class="actions">
{% for action in object.actions %}
{{ action|safe }}
{% endfor %}
</div>
{% endif %}
{% if object.url %}
</a>
{% endif %}
</li>
{% endwith %}

View File

@ -1,37 +0,0 @@
{% if tag %}
<{{ tag }} {% if css_class %} class="{{ css_class }}" {% endif %}
{% for k, v in attrs.items %}
{{ k }} = "{{ v|addslashes }}"
{% endfor %} >
{% endif %}
{% block title %}
{% if title %}
<h1>{{ title }}</h1>
{% endif %}
{% endblock %}
{% block header %}
{% if header %}
<header>
{{ header|safe }}
</header>
{% endif %}
{% endblock %}
{% block content %}
{{ content|safe }}
{% endblock %}
{% block footer %}
{% if footer %}
<footer>
{{ footer|safe }}
</footer>
{% endif %}
{% endblock %}
{% if tag %}
</{{ tag }}>
{% endif %}

View File

@ -1,111 +0,0 @@
{% if not embed %}
{% load staticfiles %}
<html>
<head>
{# FIXME: extra head block #}
<meta charset="utf-8">
<meta name="application-name" content="aircox-cms">
<meta name="description" content="{{ website.description }}">
<meta name="keywords" content="{{ website.tags }}">
<link rel="stylesheet" href="{% static "aircox/cms/styles.css" %}" type="text/css">
{% if website.styles %}
<link rel="stylesheet" href="{% static website.styles %}" type="text/css">
{% endif %}
<script src="{% static "aircox/cms/scripts.js" %}"></script>
{% if actions %}
<script>
{{ actions|safe }}
</script>
{% endif %}
<title>{% if title %}{{ title|striptags }} - {% endif %}{{ website.name }}</title>
</head>
<body>
{% block page_header %}
{% if menus.header %}
{{ menus.header|safe }}
{% endif %}
{% endblock %}
<div class="page-container">
{% if menus.top %}
{{ menus.top|safe }}
{% endif %}
<div class="page">
{% if menus.left %}
{{ menus.left|safe }}
{% endif %}
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}
{% endif %}
{% if tag %}
<{{ tag }} {% if css_class %} class="{{ css_class }}" {% endif %}
{% for k, v in attrs.items %}{{ k }} = "{{ v|addslashes }}"
{% endfor %}>
{% endif %}
{% block title %}
{% if title %}
<h1>{{ title|safe }}</h1>
{% endif %}
{% endblock %}
{% block header %}
{% if header %}
<header>
{{ header|safe }}
</header>
{% endif %}
{% endblock %}
{% block content %}
{{ content|safe }}
{% endblock %}
{% block footer %}
{% if footer %}
<footer>
{{ footer|safe }}
</footer>
{% endif %}
{% endblock %}
{% if tag %}
</{{ tag }}>
{% endif %}
{% if not embed %}
{% if menus.right %}
{{ menus.right|safe }}
{% endif %}
</div>
{% if menus.page_bottom %}
{{ menus.page_bottom|safe }}
{% endif %}
</div>
{% block page_footer %}
{% if menus.footer %}
{{ menus.footer|safe }}
{% endif %}
{% endblock %}
{% if menus.bottom %}
{{ menus.bottom|safe }}
{% endif %}
</body>
</html>
{% endif %}

View File

@ -0,0 +1,51 @@
{% load staticfiles %}
{% load i18n %}
{% load wagtailimages_tags %}
{% load wagtailsettings_tags %}
{% get_settings %}
<html>
<head>
{% 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" />
{% block css_extras %}{% endblock %}
{% endblock %}
<title>{{ page.title }}</title>
</head>
<body>
<div class="top">
<nav>
<a href="">Grille Horaire</a>
<a href="">Programmes</a>
<a href="">Contact</a>
</nav>
</div>
<div class="middle">
<nav class="left">
<img src="{{ settings.cms.WebsiteSettings.logo.file.url }}" class="logo">
</nav>
<main>
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}
{% block title %}
<h1>{{ page.title }}</h1>
{% endblock %}
{% block content %}
{% endblock %}
</main>
</div>
</body>
</html>

View File

@ -0,0 +1,38 @@
{% extends "cms/publication.html" %}
{% load i18n %}
{% block content_extras %}
{% with tracks=page.tracks.all %}
{% if tracks %}
<div class="playlist">
<h2>{% trans "Playlist" %}</h2>
<ul>
{% for track in tracks %}
<li><span class="artist">{{ track.artist }}</span>
<span class="title">{{ track.title }}</span>
{% if track.info %} <span class="info">{{ track.info }}</span>{% endif %}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% endwith %}
<div class="dates">
<h2>{% trans "Dates of diffusion" %}</h2>
<ul>
{% with diffusion=page.diffusion %}
<li>{{ diffusion.date|date:"l d F Y, H:i" }}</li>
{% for diffusion in diffusion.diffusion_set.all %}
<li>{{ diffusion.date|date:"l d F Y, H:i" }}</li>
{% endfor %}
{% endwith %}
</ul>
</div>
{# TODO: podcasts #}
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends "cms/publication.html" %}
{% load i18n %}
{% block content %}
<div>
<h2>{% trans "Practical information" %}</h2>
<ul>
{% with start=page.start|date:'l d F H:i' %}
{% with end=page.end|date:'l d F H:i' %}
<li><b>{% trans "Date" %}</b>:
{% transblock %}{{ start }} until {{ end }}{% endtransblock %}
</li>
<li><b>{% trans "Place" %}</b>: {{ page.address }}</li>
{% if page.price %}
<li><b>{% trans "Price" %}</b>: {{ page.price }}</li>
{% endif %}
{% if page.info %}<li>{{ page.info }}</li>{% endif %}
{% endwith %}
{% endwith %}
</ul>
{% endblock %}

View File

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

View File

@ -0,0 +1,60 @@
{% extends "cms/publication.html" %}
{# generic page to display programs #}
{% load i18n %}
{% load wagtailcore_tags %}
{# TODO message if program is no more active #}
{% block content_extras %}
<div class="schedule">
{% if page.program.active %}
<h2>{% trans "Schedule" %}</h2>
<ul>
{% for schedule in page.program.schedule_set.all %}
<li>
{% with frequency=schedule.get_frequency_display day=schedule.date|date:'l' %}
{% with start=schedule.date|date:"H:i" end=schedule.end|date:"H:i" %}
{% blocktrans %}
{{ day }} {{ start }} until {{ end }}, {{ frequency }}
{% endblocktrans %}
{% endwith %}
{% endwith %}
{% if schedule.initial %}
<span class="info">{% trans "Rerun" %}</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<div class="warning">{% trans "This program is no longer active" %}</div>
{% endif %}
</div>
{% endblock %}
{% block page_nav_extras %}
{% if page.program.active %}
{% with object_list=page.next_diffs %}
{% if object_list %}
<div>
<h2>{% trans "Next Diffusions" %}</h2>
{% include "cms/list.html" %}
</div>
{% endif %}
{% endwith %}
{% endif %}{# program.active #}
{% with object_list=page.prev_diffs %}
{% if object_list %}
<div>
<h2>{% trans "Previous Diffusions" %}</h2>
{% include "cms/list.html" %}
</div>
{% endif %}
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,91 @@
{% extends "cms/base_site.html" %}
{% load i18n %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% block content %}
{% if object_list %}
{# list view #}
<div class="body summary">
{{ page.summary }}
</div>
{% with list_paginator=paginator %}
{% include "cms/snippets/list.html" %}
{% endwith %}
{% else %}
{# detail view #}
<div class="content">
<img class="cover" src="{{ page.cover.file.url }}">
<div class="body">
{{ page.body|richtext}}
</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">
{% include "cms/snippets/comments.html" %}
</div>
</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 }}
{% endif %}
</div>
<time datetime="{{ page.first_published_at }}">
{% trans "Published on " %}
{{ page.first_published_at|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

@ -0,0 +1,10 @@
{% extends "cms/base_site.html" %}
{% load i18n %}
{% block title %}
{% endblock %}

View File

@ -1,9 +1,6 @@
{% extends 'aircox/cms/list.html' %}
{% load i18n %}
{% load honeypot %}
{% block header %}
{% if comment_form %}
{% with comment_form as form %}
{{ form.non_field_errors }}
@ -11,6 +8,7 @@
{% csrf_token %}
{% render_honeypot_field "hp_website" %}
<div>
<input type="hidden" name="type" value="comments">
{{ form.author.errors }}
{{ form.author }}
<div>
@ -31,7 +29,24 @@
<button type="submit">{% trans "Post!" %}</button>
</div>
</form>
<ul>
{% for comment in page.comments %}
<li class="comment">
<div class="metadata">
<a {% if comment.url %}href="{{ comment.url }}" {% endif %}
class="author">{{ comment.author }}</a>
<time datetime="{{ comment.date }}">
{{ comment.date|date:'l d F, H:i' }}
</time>
</div>
<div class="body">{{ comment.content }}</div>
</li>
{% endfor %}
</ul>
{% endwith %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,9 @@
<div class="list">
{% for page in object_list %}
{% with item=page.specific %}
{% include "cms/snippets/list_item.html" %}
{% endwith %}
{% endfor %}
</div>

View File

@ -0,0 +1,16 @@
{% load wagtailimages_tags %}
<a {% if item.url %}href="{{ item.url }}" {% endif %}class="item page_item">
{% 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 %}
<time datetime="{{ item.date }}">
{{ item.date|date:'l d F, H:i' }}
</time>
{% endif %}
{% endif %}
</a>