merge aircox and aircox_instance

This commit is contained in:
bkfox
2016-10-10 15:04:15 +02:00
parent 72fd7bd490
commit 191d337c3f
100 changed files with 4686 additions and 360 deletions

View File

@ -0,0 +1,82 @@
{% load staticfiles %}
{% load i18n %}
{% load wagtailimages_tags %}
{% load wagtailsettings_tags %}
{% load aircox_cms %}
{% get_settings %}
<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 'aircox_cms/css/layout.css' %}" type="text/css" />
<link rel="stylesheet" href="{% static 'aircox_cms/css/theme.css' %}" type="text/css" />
{% block css_extras %}{% endblock %}
{% endblock %}
<script src="{% static 'aircox_cms/js/utils.js' %}"></script>
<script src="{% static 'aircox_cms/js/player.js' %}"></script>
<title>{{ page.title }}</title>
</head>
<body>
<div class="menu top">
{% render_sections position="top" %}
</div>
<header class="header">
{% render_sections position="header" %}
</header>
<div class="page flex_row">
<nav class="menu page_left flex_item">
{% render_sections position="page_left" %}
</nav>
<main class="flex_item {% if not object_list %}detail{% endif %}">
{% if messages %}
<ul class="messages">
{% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>
{{ message }}
</li>
{% endfor %}
</ul>
{% endif %}
<header>
{% block title %}
<h1>{{ page.title }}</h1>
{% endblock %}
</header>
{% block content %}
{% endblock %}
</main>
<nav class="menu page_right flex_item">
{% render_sections position="page_right" %}
</nav>
</div>
{% block footer %}
<footer class="footer">
{% render_sections position="footer" %}
<div class="small float_right">Propulsed by
<a href="https://github.com/bkfox/aircox">Aircox</a>
</div>
</footer>
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,15 @@
{% extends "aircox_cms/base_site.html" %}
{# display a timetable of planified diffusions by days #}
{% load wagtailcore_tags %}
{% block content %}
{% if page.body %}
<div class="body">
{{ page.body|richtext }}
</div>
{% endif %}
{% include "aircox_cms/snippets/date_list.html" %}
{% endblock %}

View File

@ -0,0 +1,68 @@
{% extends "aircox_cms/publication.html" %}
{% load i18n %}
{% block content_extras %}
{% with tracks=page.tracks.all %}
{% if tracks %}
<section 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>
</section>
{% endif %}
{% endwith %}
<section 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>
</section>
{% with podcasts=self.get_podcasts %}
{% if podcasts %}
<section class="podcasts list">
<h2>{% trans "Podcasts" %}</h2>
<div id="player_diff_{{ page.id }}" class="player">
{% include 'aircox_cms/snippets/player.html' %}
<script>
var podcasts = new Player('player_diff_{{ page.id }}', undefined, true)
{% for item in podcasts %}
{% if not item.embed %}
podcasts.playlist.add(new Sound(
title='{{ item.name|escape }}',
detail='{{ item.detail_url }}',
duration={{ item.duration|date:"H*3600+i*60+s" }},
streams='{{ item.url }}',
{% if page and page.cover %}cover='{{ page.icon }}',{% endif %}
undefined
));
{% endif %}
{% endfor %}
</script>
<p>
{% for item in podcasts %}
{% if item.embed %}
{{ item.embed|safe }}
{% endif %}
{% endfor %}
</p>
</div>
</section>
{% endif %}
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,24 @@
{% extends "aircox_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,61 @@
{% extends "aircox_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 "aircox_cms/snippets/list.html" %}
{% endwith %}
{% else %}
<div class="body">
{{ page.body|richtext }}
</div>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,34 @@
{% extends "aircox_cms/publication.html" %}
{# generic page to display programs #}
{% load i18n %}
{% load wagtailcore_tags %}
{# TODO message if program is no more active #}
{% block content_extras %}
<section 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 %}
</section>
{% endblock %}

View File

@ -0,0 +1,60 @@
{% extends "aircox_cms/base_site.html" %}
{% load i18n %}
{% load wagtailcore_tags %}
{% load wagtailimages_tags %}
{% load aircox_cms %}
{% if not object_list %}
{% block title %}
<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:24 }}
{% endif %}
</section>
{% endblock %}
{% endif %}
{% block content %}
{% if object_list %}
{# list view #}
<section class="body summary">
{{ page.summary }}
<a href="?" class="go_back">{% trans "Go back to the publication" %}</a>
</section>
{% with list_paginator=paginator %}
{% include "aircox_cms/snippets/list.html" %}
{% endwith %}
{% else %}
{# detail view #}
<div class="content">
<section class="body">
{{ page.body|richtext}}
</section>
{% block content_extras %}{% endblock %}
<div class="post_content">
{% render_sections position="post_content" %}
</div>
<section class="comments">
{% include "aircox_cms/snippets/comments.html" %}
</section>
</div>
{% endif %}
{% endblock %}

View File

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

View File

@ -0,0 +1,13 @@
{% extends "aircox_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 link_icon" height='' width='' %}{% endif %}
{{ link.text }}
</a>
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends "aircox_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-24x24 class="icon" %}{% endif %}
{{ link.text }}
</a>
{% endwith %}
{% endfor %}
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends "aircox_cms/sections/section_item.html" %}
{% block content %}
{% if focus %}
{% with item=focus item_big_cover=True %}
{% include "aircox_cms/snippets/list_item.html" %}
{% endwith %}
{% endif %}
{% with url=url url_text=self.url_text %}
{% include "aircox_cms/snippets/list.html" %}
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,10 @@
{% extends "aircox_cms/sections/section_item.html" %}
{% block content %}
{% with item_date_format="H:i" list_css_class="date_list" list_no_cover=True %}
{% for item in object_list %}
{% include "aircox_cms/snippets/date_list_item.html" %}
{% endfor %}
{% endwith %}
{% endblock %}

View File

@ -0,0 +1,27 @@
{% extends 'aircox_cms/sections/section_item.html' %}
{% block content %}
<div id="player" class="player">
{% include "aircox_cms/snippets/player.html" %}
</div>
<script>
var player = new Player('player', '{% url 'aircox.on_air' %}');
var sound = player.playlist.add(
new Sound(
'{{ self.live_title }}',
'', undefined,
streams=[ {% for stream in streams %}'{{ stream }}',{% endfor %} ],
cover = undefined,
on_air = true
)
);
sound.item.className += ' live';
player.playlist.select(sound, false);
</script>
{% endblock %}

View File

@ -0,0 +1,60 @@
{% extends "aircox_cms/sections/section_item.html" %}
{% load i18n %}
{% load static %}
{% load wagtailsettings_tags %}
{% block content %}
<div class="meta">
<div class="author">
{% if page.publish_as %}
{% with item=page.publish_as item_date_format='' %}
{% include "aircox_cms/snippets/list_item.html" %}
{% endwith %}
{% elif page.owner %}
{% trans "Published by" %}
{{ page.owner }}
{% endif %}
</div>
{% 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>
{% endif %}
{% endwith %}
{% with list_page=settings.cms.WebsiteSettings.list_page %}
{% if list_page and page.tags.count %}
<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 "aircox_cms/images/share.png" %}" alt="{% trans "Share" %}"
class="small_icon">
<a href="mailto:?&body={{ page.full_url|urlencode }}"
target="new">
<img src="{% static "aircox_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 "aircox_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 "aircox_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 "aircox_cms/images/gplus.png" %}" alt="Google Plus" class="small_icon">
</a>
</div>
</div>
{% endblock %}

View File

@ -0,0 +1,16 @@
{% extends "aircox_cms/sections/section_item.html" %}
{% 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 "aircox_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

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

View File

@ -0,0 +1,55 @@
{% load i18n %}
{% load static %}
{% load honeypot %}
{% if comment_form or page.comments %}
<h2><img src="{% static "aircox_cms/images/comments.png" %}" class="icon">{% trans "Comments" %}</h2>
{% endif %}
{% if comment_form %}
{% with comment_form as form %}
{{ form.non_field_errors }}
<form action="" method="POST">
{% csrf_token %}
{% render_honeypot_field "hp_website" %}
<div>
<input type="hidden" name="type" value="comments">
{{ form.author.errors }}
{{ form.author }}
<div>
<input type="checkbox" value="1" id="show_more">
<label for="show_more">{% trans "show more options" %}</label>
<div class="extra">
{{ form.email.errors }}
{{ form.email }}
{{ form.url.errors }}
{{ form.url }}
</div>
</div>
</div>
<div>
{{ form.content.errors }}
{{ form.content }}
<button type="submit">{% trans "Post!" %}</button>
</div>
</form>
{% endwith %}
{% endif %}
<ul class="list">
{% 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>

View File

@ -0,0 +1,39 @@
{% load i18n %}
{# FIXME: get current complete URL #}
<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" %}"></a>
{% endif %}
{% for day in nav_dates.dates %}
<a onclick="select_tab(this, '.panel[data-date=\'{{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" %}"></a>
{% endif %}
</nav>
{% endif %}
{% for day, list in object_list %}
<ul class="panel {% if day == nav_dates.date %}class="today"{% endif %}"
{% if day == nav_dates.date %}selected{% endif %}
data-date="{{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 item_date_format="H:i" %}
{% for item in list %}
{% include "aircox_cms/snippets/date_list_item.html" %}
{% endfor %}
{% endwith %}
</ul>
{% endfor %}
</div>

View File

@ -0,0 +1,45 @@
{% 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 not list_no_cover %}
{% 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 %}
{% endif %}
<div class="flex_item">
<h3 class="title">{{ 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

@ -0,0 +1,65 @@
{% 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 %}
<ul class="list {{ list_css_class|default:'' }}">
{% for page in object_list %}
{% with item=page.specific %}
{% include "aircox_cms/snippets/list_item.html" %}
{% endwith %}
{% endfor %}
{# we use list_paginator to avoid conflicts when there are multiple lists #}
{% if list_paginator and list_paginator.num_pages > 1 %}
<nav>
{% with list_paginator.num_pages as num_pages %}
{% if object_list.has_previous %}
<a href="?page={{ object_list.previous_page_number }}">
{% trans "previous page" %}
</a>
{% endif %}
{% if object_list.number > 3 %}
<a href="?page=1">1</a>
{% if object_list.number > 4 %}
&#8230;
{% endif %}
{% endif %}
{% for i in object_list.number|around:2 %}
{% if i == object_list.number %}
{{ object_list.number }}
{% elif i > 0 and i <= num_pages %}
<a href="?page={{ i }}">{{ i }}</a>
{% endif %}
{% endfor %}
{% with object_list.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 object_list.has_next %}
<a href="?page={{ object_list.next_page_number }}">
{% trans "next page" %}
</a>
{% endif %}
{% endwith %}
</nav>
{% elif url and url_text %}
<nav><a href="{{ url }}">{{ url_text }}</a></nav>
{% endif %}
</ul>

View File

@ -0,0 +1,51 @@
{% comment %}
Configurable item to be put in a list. Support standard Publication or
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. 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 static %}
{% load wagtailimages_tags %}
<a {% if item.url %}href="{{ item.url }}" {% endif %}
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 %}
<div class="flex_item">
<h3 class="title">{{ item.title }}</h3>
{% if item.info %}
<span class="info">{{ item.info|safe }}</span>
{% endif %}
{% if not item.show_in_menus and item.date and item_date_format != '' %}
{% with date_format=item_date_format|default:'l d F, H:i' %}
<time datetime="{{ item.date }}">
{% if item.diffusion %}
<img src="{% static "aircox_cms/images/clock.png" %}" class="small_icon">
{{ item.diffusion.start|date:date_format }}
{% else %}
{{ item.date|date:date_format }}
{% endif %}
</time>
{% endwith %}
{% endif %}
</div>
{% if item.extra %}
<div class="extra"></div>
{% endif %}
</a>

View File

@ -0,0 +1,46 @@
{% load staticfiles %}
{% load i18n %}
<audio preload="metadata">
{% trans "Your browser does not support the <code>audio</code> element." %}
{% for stream in streams %}
<source src="{{ stream }}" />
{% endfor %}
</audio>
<div class="playlist">
<li class='item list_item flex_row' style="display: none;">
<div class="button">
<img src="{% static "aircox_cms/images/play.png" %}" class="play"
title="{% trans "play" %}" />
<img src="{% static "aircox_cms/images/pause.png" %}" class="pause"
title="{% trans "pause" %}" />
<img src="{% static "aircox_cms/images/loading.png" %}" class="loading"
title="{% trans "loading..." %}" />
</div>
<div class="flex_item">
<h3 class="title flex_item">{{ self.live_title }}</h3>
<div class="content flex_row">
<span class="info duration flex_item"></span>
<span class="actions">
<a class="action add" title="{% trans "add to the player" %}">+</a>
<a class="action detail" title="{% trans "more informations" %}"></a>
<a class="action remove" title="{% trans "remove this sound" %}"></a>
</span>
</div>
</div>
</li>
</div>
<div class="controls">
<span class="progress">
<span class="info duration"></span>
<progress class="flex_item progress" value="0" max="1"></progress>
</span>
<input type="checkbox" class="single" id="player_single_mode">
<label for="player_single_mode" class="info"
title="{% trans "enable and disable single mode" %}"></label>
</div>

View File

@ -0,0 +1,42 @@
{% load static %}
{% load i18n %}
{% if item.embed %}
{% else %}
{# TODO: complete archive podcast -> info #}
<script>
function add_sound_{{ item.id }}(event) {
var sound = new Sound(
title='{{ item.name|escape }}',
detail='{{ item.detail_url }}',
duration={{ item.duration|date:"H*3600+i*60+s" }},
streams='{{ item.url }}',
{% if page and page.cover %}cover='{{ page.icon }}'{% endif %}
);
sound = player.playlist.add(sound);
if(event.target.dataset.action != 'add')
player.select(sound, true);
}
</script>
<a class="list_item sound flex_row" onclick="add_sound_{{ item.id }}(event)">
<img src="{% static "aircox_cms/images/listen.png" %}" class="icon"/>
<h3 class="flex_item">{{ item.name }}</h3>
<time class="info">
{% if item.duration.hour > 0 %}
{{ item.duration|date:'H:i:s' }}
{% else %}
{{ item.duration|date:'i:s' }}
{% endif %}
</time>
<img src="{% static "aircox_cms/images/add.png" %}" class="icon"
data-action='add' alt="{% trans "add this sound to the playlist" %}"/>
</a>
{% endif %}