Updated date information for the shows.

Shows are now sorted by date. This date is the real show date for
Combaillaux shows, and the last date for the company shows.

Dates can now be cancelled. Cancelled dates are reported on the pages
and on the calendar, but tagged as such.
This commit is contained in:
David Soulayrol 2020-08-22 10:15:02 +02:00
commit e731644536
6 changed files with 42 additions and 22 deletions

View file

@ -61,3 +61,15 @@ h1 > small {
#sidebar h3 {
font-variant: small-caps;
}
.tes-show-cancelled h3:after {
content: "ANNULÉ";
color: #f00;
font-weight: bold;
padding-left: 0.6em;
}
.page-content-troupe .tes-show-cancelled h3:after {
content: "";
padding-left: 0;
}

View file

@ -87,6 +87,8 @@ var OpenAgendaControler = extend_object(AgendaControler, function () {
a = $('<article class="tes-agenda-details-' + event_data.section + '"><div></div></article>')
a.append($('<h3><a href="' + event_data.url + '">' + event_data.title + '</a></h3>'))
a.append(desc)
if (event_data.cancelled)
a.addClass('tes-show-cancelled')
articles.push(a)
url_sorted_events[event_data.url] = a
}

View file

@ -41,7 +41,7 @@
{% endblock %}
</div>
<div class="page-content">
<div class="page-content page-content-{{site_section}}">
{% block main %}
{% endblock %}
</div>

View file

@ -9,14 +9,10 @@
{% macro build_show_header(show, config) %}
<section>
{% if config != null %}
{% if config.display_date != undefined %}
<p class="date">{{ config.display_date }}</p>
{% elif not config.no_display_date %}
<p class="date">{{ moment(show.lastDate).format('LL') }}</p>
{% endif %}
{% else %}
<p class="date">{{ moment(show.lastDate).format('LL') }}</p>
{% if config.display_date != undefined %}
<p class="date">{{ config.display_date }}</p>
{% elif not config.no_display_date %}
<p class="date">{{ moment(show.date).format('LL') }}</p>
{% endif %}
<h3><a href="/{{ show.path }}">{{ show.title }}</a></h3>
<p>
@ -34,7 +30,7 @@
{% macro expose_show(show, config) %}
<article class="container">
<section class="row">
<section class="row {% if show.cancelled %}tes-show-cancelled{% endif %}">
<section class="col-sm-12 col-md-2 center">
<a href="/{{ show.path }}">
<img src="/images/thumbnails/tn_{{ show.poster }}" alt="{{ show.title }}">
@ -86,11 +82,11 @@
{% set shows = collections[category] %}
{% for show in shows %}
{% if config.before %}
{% if moment(show.lastDate).isBefore(config.before) %}
{% if moment(show.date).isBefore(config.before) %}
{{ config.render(show, config) }}
{% endif %}
{% elif config.after %}
{% if moment(show.lastDate).isAfter(config.after) %}
{% if moment(show.date).isAfter(config.after) %}
{{ config.render(show, config) }}
{% endif %}
{% elif config.ongoing != undefined %}

View file

@ -12,6 +12,15 @@ const paths = require('../config/paths')
*/
module.exports = plugin
json2md.converters.tes_date = function (input, json2md) {
var line = json2md(input.date + ' ' + input.place)
if (input.cancelled) {
return '<del>' + line + '</del> **ANNULÉ**'
} else {
return line
}
}
/**
* Metalsmith plugin to inject shows articles and data into the files
* list.
@ -164,11 +173,9 @@ function plugin () {
contents.push({ 'h2': 'Représentation' + plural })
data.dates.forEach(function (event) {
var m = moment(event.date)
if (m.hours() === 0) {
list.push(m.format('LL') + ' ' + event.place)
} else {
list.push(m.format('LLLL') + ' ' + event.place)
}
var date = m.hours() === 0 ? m.format('LL') : m.format('LLLL')
list.push({ 'tes_date': {
'date': date, 'place': event.place, 'cancelled': event.cancelled || false }})
lastDate = event.date
})
contents.push({ 'ul': list })
@ -179,17 +186,19 @@ function plugin () {
author: get('author'),
creation: data.creation,
company: data.company,
cancelled: false,
ongoing: data.ongoing || false,
layout: data.layout || 'show.njk',
poster: get('poster') || path.basename(filename, 'md') + 'jpg',
lastDate: lastDate,
date: lastDate,
synopsis: Buffer.from(json2md(data.synopsis || [])),
contents: Buffer.from(json2md(contents))
})
if (section === 'combaillaux') {
data.dates.forEach((event) => {
this.files[this.createUrl(filename, data, event)] = Object.assign({}, entry, { 'lastDate': event.date })
this.files[this.createUrl(filename, data, event)] = Object.assign({}, entry, {
'date': event.date, 'cancelled': event.cancelled || false })
})
} else {
/**
@ -215,6 +224,7 @@ function plugin () {
'company': data.company,
'date': d.format('YYYY-MM-DD'),
'place': event.place,
'cancelled': event.cancelled || false,
'url': this.createUrl(filename, data, event).replace(/md$/, 'html')
})
})

View file

@ -85,17 +85,17 @@ module.exports = new Metalsmith(paths.projectRoot)
.use(collections({
combaillaux: {
pattern: 'combaillaux/**/*.njk',
sortBy: 'lastDate',
sortBy: 'date',
reverse: true
},
news: {
pattern: 'news/*.njk',
sortBy: 'lastDate',
sortBy: 'date',
reverse: true
},
troupe_shows: {
pattern: 'troupe/*.njk',
sortBy: 'lastDate',
sortBy: 'date',
reverse: true
},
troupe_creations: {