#132 | #121: backoffice / dev-1.0-121 (#131)

cfr #121

Co-authored-by: Christophe Siraut <d@tobald.eu.org>
Co-authored-by: bkfox <thomas bkfox net>
Co-authored-by: Thomas Kairos <thomas@bkfox.net>
Reviewed-on: rc/aircox#131
Co-authored-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
Co-committed-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
This commit is contained in:
2024-04-28 22:02:09 +02:00
committed by Thomas Kairos
parent 1e17a1334a
commit 55123c386d
348 changed files with 124397 additions and 17879 deletions

View File

@ -0,0 +1,4 @@
{% extends "./page.html" %}
{% load humanize %}
{% block subtitle %}{{ object.pub_date.date }}{% endblock %}

View File

@ -0,0 +1,4 @@
<a-autocomplete
url="{{url}}"
{% if ":name" not in widget.attrs %}name="{{ name|default:widget.name }}"{% endif %}{% if widget.value != None %} model-value="{{ widget.value|stringformat:'s' }}"{% endif %}
{% include "django/forms/widgets/attrs.html" %} {{ extra|default:"" }}/>

View File

@ -11,63 +11,48 @@ Context variables:
- is_thin (=False): if True, smaller cover and display less info
{% endcomment %}
{% if render_card %}
<article class="card {% if is_primary %}is-primary{% endif %}">
<header class="card-image">
<a href="{{ object.get_absolute_url }}">
<figure class="image is-4by3">
<img src="{% thumbnail object.cover|default:station.default_cover 480x480 %}">
</figure>
</a>
{% block outer %}
<article class="preview preview-item{% if is_primary %}is-primary{% endif %}{% block card_class %}{% endblock %}">
{% block inner %}
<header class="headings"
style="background-image: url({{ object.cover.url }})">
{% block headings %}
<div>
<span class="heading subtitle">{% block subtitle %}{% endblock %}</span>
</div>
{% endblock %}
</header>
<div class="card-header">
<h4 class="title">
<a href="{{ object.get_absolute_url }}">
{% block card_title %}{{ object.title }}{% endblock %}
</a>
</h4>
</div>
</article>
<div class="">
<div>
<h2 class="heading title">{% block title %}{% endblock %}</h2>
</div>
{% else %}
<article class="media item {% block css %}{% endblock%}">
{% if has_cover|default_if_none:True %}
<div class="media-left">
{% if is_thin %}
<img src="{% thumbnail object.cover|default:station.default_cover 64x64 crop=scale %}"
class="cover is-tiny">
{% else %}
<img src="{% thumbnail object.cover|default:station.default_cover 128x128 crop=scale %}"
class="cover is-small">
{% endif %}
</div>
{% endif %}
<div class="media-content">
<h5 class="title is-5 has-text-weight-normal">
{% block title %}
{% if object.is_published %}
<a href="{{ object.get_absolute_url }}">{{ object.title }}</a>
{% else %}
{{ object.title }}
<summary class="heading-container">
{% block content %}
{% if content and with_content %}
{% autoescape off %}
{{ content|striptags|truncatewords:64|linebreaks }}
{% endautoescape %}
{% endif %}
{% endblock %}
</h5>
<div class="subtitle is-6 has-text-weight-light">
{% block subtitle %}
{% if object.category %}{{ object.category.title }}{% endif %}
{% endblock %}
</div>
</summary>
{% if has_headline|default_if_none:True %}
<div class="headline">
{% block headline %}{{ object.headline }}{% endblock %}
<div class="actions">
{% block actions %}
<a class="button float-right" href="{{ object.get_absolute_url|escape }}">
<span class="icon">
<i class="fas fa-external-link"></i>
</span>
<label>{% translate "More infos" %}</label>
</a>
{% endblock %}
</div>
{% endif %}
</div>
{% endblock %}
{% if not no_actions %}
{% block actions %}{% endblock %}
{% if with_container %}
</div>
{% endif %}
</article>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,15 @@
{% load aircox %}
<a href="{% url page.list_url_name %}">
{{ page|verbose_name:True }}
</a>
{% if page.category and not no_cat %}
<a href="{% url page.list_url_name category_slug=page.category.slug %}">
{{ page.category.title }}
</a>
{% endif %}
{% if not no_title %}
<a href="{{ page.get_absolute_url }}">
{{ page.title|truncatechars:24 }}
</a>
{% endif %}

View File

@ -0,0 +1,23 @@
{% extends "./preview.html" %}
{% load i18n %}
{% block tag-class %}{{ block.super }} preview-card{% endblock %}
{% block inner %}
<div class="card-content">
{% if cover %}
{% if url %}<a href="{{ url }}">{% endif %}
<figure style="background-image: url({{ cover }});" class="preview-cover">
<img src="{{ cover }}" class="hide">
</figure>
{% if url %}</a>{% endif %}
{% endif %}
<footer class="actions">
{% block actions %}{{ block.super }}{% endblock %}
</footer>
</div>
{% block headings-container %}{{ block.super }}{% endblock %}
{% endblock %}

View File

@ -0,0 +1,28 @@
{% load aircox %}
{% comment %}
Context:
- objects: list of objects to display
- url_name: url name to show the full list
- url_parent: parent page for the full list
- url_label: label of url button
{% endcomment %}
<a-carousel>
{% for object in objects %}
{% page_widget "card" object %}
{% endfor %}
</a-carousel>
{% if url_name %}
<nav class="nav-urls">
{% if url_parent %}
<a href="{% url url_name parent_slug=url_parent.slug %}">
{% elif url_category %}
<a href="{% url url_name category_slug=url_category.slug %}">
{% else %}
<a href="{% url url_name %}">
{% endif %}
{{ url_label|default:_("Show all") }}
</a>
</nav>
{% endif %}

View File

@ -0,0 +1,55 @@
{% extends "./page.html" %}
{% load i18n humanize aircox %}
{% block tag-class %}{{ block.super }} comment{% endblock %}
{% block outer %}
{% with url=object.get_absolute_url %}
{% if with_title %}
{{ block.super }}
{{ block.super }}
{% else %}
{{ block.super }}
{{ block.super }}
{% endif %}
{% endwith %}
{% endblock %}
{% block title %}
{{ object.nickname }} &mdash; {{ object.date }}
{% endblock %}
{% block subtitle %}
{% if with_title %}
{{ object.parent.title }}
{% endif %}
{% endblock %}
{% block content %}{{ object.content }}{% endblock %}
{% block actions %}
{{ block.super }}
{% if admin %}
{% if user.is_staff %}
<a href="{% url "admin:aircox_comment_change" object.pk %}" class="button"
title="{% trans "Edit comment" %}"
aria-label="{% trans "Edit comment" %}">
<span class="fa fa-edit"></span>
</a>
{% endif %}
<a-action-button class="button is-danger"
title="{% trans "Delete comment" %}"
aria-label="{% trans "Delete comment" %}"
url="{% url "api:comment-detail" object.pk %}"
icon="fa fa-trash-alt"
method="delete"
confirm="{% translate "Delete comment?" %}"
@done="deleteElements('#{{ object|object_id }}')"
/>
{# <a href="mailto:{{ object.email }}">{{ object.nickname }}</a> #}
{% endif %}
{% endblock %}

View File

@ -11,36 +11,33 @@ An empty date results to a title or a separator
{% endcomment %}
{% load i18n %}
<div class="media" role="menu"
aria-label="{% translate "pick a date" %}">
<div class="media-content">
<div class="tabs is-toggle">
<ul>
{% for day in dates %}
<li class="{% if day == date %}is-active{% endif %}">
<a href="{% url url_name date=day %}">
{{ day|date:"D. d" }}
</a>
</li>
{% endfor %}
</ul>
</div>
</div>
<a-switch class="button burger"
el=".nav-dates" icon="far fa-calendar" group="nav"
aria-label="{% translate "Dates" %}">
</a-switch>
<div class="media-right">
<form action="{% url url_name %}" method="GET" class="navbar-body"
aria-label="{% translate "Jump to date" %}">
<div class="field has-addons">
<div class="control has-icons-left">
<span class="icon is-small is-left"><span class="far fa-calendar"></span></span>
<input type="{{ date_input|default:"date" }}" class="input date"
name="date" value="{{ date|date:"Y-m-d" }}">
</div>
<div class="control">
{% comment %}Translators: form button to select a date{% endcomment %}
<button class="button is-primary">{% translate "Go" %}</button>
<div class="nav-menu nav-dates">
{% for day in dates %}
<a href="{% url url_name date=day %}" class="nav-item {% if day == date %}active{% endif %}">
{{ day|date:"l d" }}
</a>
{% endfor %}
<a-dropdown class="nav-item align-right flex-grow-0 dropdown is-right"
content-class="dropdown-menu"
button-tag="span" button-class="dropdown-trigger"
button-icon-open="fa-solid fa-plus" button-icon-close="fa-solid fa-minus">
<template #default>
<div class="dropdown-content">
<div class="dropdown-item">
<h4>{% translate "Pick a date" %}</h4>
<v-calendar mode="date" borderless
:initial-page="{month: {{date.month}}, year: {{date.year}}}"
@dayclick="(event) => window.aircox.pickDate({% url url_name %}, event)"
color="yellow"
/>
</div>
</div>
</form>
</div>
</template>
</a-dropdown>
</div>

View File

@ -3,19 +3,4 @@ Context:
- object_list: object list
- date: date for list
{% endcomment %}
<table id="timetable{% if date %}-{{ date|date:"Y-m-d" }}{% endif %}" class="timetable">
{% for diffusion in object_list %}
<tr class="{% if diffusion.is_now %}has-background-primary{% endif %}">
<td class="pr-2 pb-2">
<time datetime="{{ diffusion.start|date:"c" }}">
{{ diffusion.start|date:"H:i" }} - {{ diffusion.end|date:"H:i" }}
</time>
</td>
<td class="pb-2">
{% with diffusion.episode as object %}
{% include "aircox/widgets/episode_item.html" %}
{% endwith %}
</td>
</tr>
{% endfor %}
</table>
{% load aircox %}

View File

@ -0,0 +1,26 @@
{% comment %}
Context:
- object: diffusion
{% endcomment %}
{% load i18n %}
{% if object.type == object.TYPE_ON_AIR %}
<span class="tag is-info">
<span class="icon is-small">
{% if object.is_live %}
<i class="fa fa-microphone"
title="{% translate "Live diffusion" %}"></i>
{% else %}
<i class="fa fa-music"
title="{% translate "Differed diffusion" %}"></i>
{% endif %}
</span>
&nbsp;
{{ object.get_type_display }}
</span>
{% elif object.type == object.TYPE_CANCEL %}
<span class="tag is-danger">
{{ object.get_type_display }}</span>
{% elif object.type == object.TYPE_UNCONFIRMED %}
<span class="tag is-warning">
{{ object.get_type_display }}</span>
{% endif %}

View File

@ -0,0 +1,71 @@
{% extends "./page.html" %}
{% load i18n humanize aircox %}
{% block outer %}
{% with diffusion.is_now as is_active %}
{{ block.super }}
{% endwith %}
{% endblock %}
{% block subtitle %}
{% if diffusion %}
{% if timetable %}
{{ diffusion.start|date:"H:i" }}
&mdash;
{{ diffusion.end|date:"H:i" }}
{% else %}
{{ diffusion.start|naturalday }},
{{ diffusion.start|date:"H:i" }}
{% endif %}
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}
{% block actions-container %}
{% if admin and diffusion %}
<div class="flex-row">
<div class="flex-grow-1">
{% if diffusion.type == diffusion.TYPE_ON_AIR %}
<span class="tag is-info">
<span class="icon is-small">
{% if diffusion.is_live %}
<i class="fa fa-microphone"
title="{% translate "Live diffusion" %}"></i>
{% else %}
<i class="fa fa-music"
title="{% translate "Differed diffusion" %}"></i>
{% endif %}
</span>
&nbsp;
{{ diffusion.get_type_display }}
</span>
{% elif diffusion.type == diffusion.TYPE_CANCEL %}
<span class="tag is-danger">
{{ diffusion.get_type_display }}</span>
{% elif diffusion.type == diffusion.TYPE_UNCONFIRMED %}
<span class="tag is-warning">
{{ diffusion.get_type_display }}</span>
{% endif %}
</div>
{{ block.super }}
</div>
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}
{% block actions %}
{{ block.super }}
{% if object.sound_set.count %}
<button class="button action" @click="player.playButtonClick($event)"
data-sounds="{{ object.podcasts|json }}">
<span class="icon is-small">
<span class="fas fa-play"></span>
</span>
<label>{% translate "Listen" %}</label>
</button>
{% endif %}
{% endblock %}

View File

@ -1,58 +1,36 @@
{% extends "aircox/widgets/page_item.html" %}
{% comment %}
List item for an episode.
Context variables:
- object: episode
- diffusion: episode's diffusion
- hide_schedule: if True, do not display start time
{% endcomment %}
{% load i18n easy_thumbnails_tags aircox %}
{% extends "./basepage_item.html" %}
{% load i18n humanize %}
{% block title %}
{% if not object.is_published and object.program.is_published %}
<a href="{{ object.program.get_absolute_url }}">
{{ object.program.title }}
{% if diffusion %}
&mdash;
{{ diffusion.start|date:"d F" }}
{% endif %}
</a>
<a href="{{ object.program.get_absolute_url }}">
{{ object.program.title }}
</a>
{% else %}
{{ block.super }}
{{ block.super }}
{% endif %}
{% endblock %}
{% block class %}
{% if object.is_now %}is-active{% endif %}
{% endblock %}
{% block subtitle %}
{{ block.super }}
{% if diffusion %}
{% if not hide_schedule %}
{% if object.category %}&mdash;{% endif %}
<time datetime="{{ diffusion.start|date:"c" }}" title="{{ diffusion.start }}">
{{ diffusion.start|date:"d M, H:i" }}
</time>
{% endif %}
{{ diffusion.start|naturalday }},
{{ diffusion.start|date:"g:i" }}
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}
{% if diffusion.initial %}
{% with diffusion.initial.date as date %}
<span title="{% blocktranslate %}Rerun of {{ date }}{% endblocktranslate %}">
{% translate "(rerun)" %}
</span>
{% block content %}
{% if not object.content %}
{% with object.parent.content as content %}
{{ block.super }}
{% endwith %}
{% endif %}
{% endif %}
{% endblock %}
{% block actions %}
{% if object.sound_set.public.count %}
<button class="button" @click="player.playButtonClick($event)"
data-sounds="{{ object.podcasts|json }}">
<span class="icon is-small">
<span class="fas fa-play"></span>
</span>
</button>
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,34 @@
{% extends "./preview.html" %}
{% load i18n aircox %}
{% block tag-class %}{{ block.super }} list-item is-fullwidth{% endblock %}
{% block headings %}
<a href="{{ url|escape }}" class="heading title {% block title-class %}{% endblock %}">
{% block title %}{{ title|default:"" }}{% endblock %}
</a>
<span class="heading subtitle {% block subtitle-class %}{% endblock %}">
{% block subtitle %}{{ subtitle|default:"" }}{% endblock %}
</span>
{% endblock %}
{% block inner %}
{% block headings-container %}{{ block.super }}{% endblock %}
{% block content-container %}
<div class="media">
{% if object.cover and not no_cover %}
<a href="{{ object.get_absolute_url }}"
class="media-left preview-cover small"
style="background-image: url({{ object.cover.url }})">
</a>
{% endif %}
<div class="media-content flex-column">
<section class="content flex-grow-1">
{% block content %}{{ block.super }}{% endblock %}
</section>
{% block actions-container %}{{ block.super }}{% endblock %}
</div>
</div>
{% endblock %}
{% endblock %}

View File

@ -0,0 +1,39 @@
{% comment %}
Context:
- is_paginated: if True, page is paginated
- page_obj: page object from list view;
{% endcomment %}
{% load i18n aircox %}
{% if is_paginated %}
<hr/>
{% update_query request.GET.copy page=None as GET %}
{% with GET.urlencode as GET %}
<nav class="nav-urls is-centered" role="pagination" aria-label="{% translate "pagination" %}">
<ul class="urls">
{% if page_obj.has_previous %}
{% comment %}Translators: Bottom of the list, "previous page"{% endcomment %}
<a href="?{{ GET }}&page={{ page_obj.previous_page_number }}" class="left"
title="{% translate "Previous" %}"
aria-label="{% translate "Previous" %}">
<span class="icon"><i class="fa fa-chevron-left"></i></span>
</a>
{% endif %}
<span>
{{ page_obj.number }} / {{ page_obj.paginator.num_pages }}
</span>
{% if page_obj.has_next %}
{% comment %}Translators: Bottom of the list, "Nextpage"{% endcomment %}
<a href="?{{ GET }}&page={{ page_obj.next_page_number }}" class="right"
title="{% translate "Next" %}"
aria-label="{% translate "Next" %}">
<span class="icon"><i class="fa fa-chevron-right"></i></span>
</a>
{% endif %}
</ul>
</nav>
{% endwith %}
{% endif %}

View File

@ -0,0 +1,23 @@
{% load i18n aircox %}
{% comment %}
List item for a log, either for a logged track or diffusion (as diffusion).
Context objects:
- object: object to render
- hide_schedule: if true, hide the schedule
In case of modification, you might want to check on `assets/vue/player.vue`
for design review.
{% endcomment %}
{% block outer %}
{% if object|is_diffusion %}
{% page_widget widget object.episode diffusion=object timetable=timetable|default:False %}
{% elif object|is_log %}
{% include "./track_item.html" with object=object.track log=object timetable=timetable|default:False %}
{% else %}
{% for obj in object %}
{% include "./track_item.html" with object=obj.track log=obj timetable=timetable|default:False %}
{% endfor %}
{% endif %}
{% endblock %}

View File

@ -1,22 +0,0 @@
{% load i18n aircox %}
{% comment %}
List item for a log, either for a logged track or diffusion (as diffusion).
Context objects:
- object: object to render
- hide_schedule: if true, hide the schedule
In case of modification, you might want to check on `assets/vue/player.vue`
for design review.
{% endcomment %}
{% if object|is_diffusion %}
{% with object as diffusion %}
{% include "aircox/widgets/diffusion_item.html" %}
{% endwith %}
{% else %}
{% with object.track as object %}
{% include "aircox/widgets/track_item.html" %}
{% endwith %}
{% endif %}

View File

@ -1,30 +0,0 @@
{% comment %}
Render list of logs (as widget).
Context:
- object_list: list of logs to display
- is_thin: if True, hide some information in order to fit in a thin container
{% endcomment %}
{% load aircox %}
{% with True as hide_schedule %}
<table class="table is-striped is-hoverable is-fullwidth" role="list">
{% for object in object_list %}
<tr {% if object|is_diffusion and object.is_now %}class="is-selected"{% endif %}>
<td>
{% if object|is_diffusion %}
<time datetime="{{ object.start }}" title="{{ object.start }}">
{{ object.start|date:"H:i" }}
{% if not is_thin %} - {{ object.end|date:"H:i" }}{% endif %}
</time>
{% else %}
<time datetime="{{ object.date }}" title="{{ object.date }}">
{{ object.date|date:"H:i" }}
</time>
{% endif %}
</td>
<td>{% include "aircox/widgets/log_item.html" %}</td>
</tr>
{% endfor %}
</table>
{% endwith %}

View File

@ -0,0 +1,35 @@
{% comment %}
Context:
- object_list: list of logs
- timetable: defaults to False
- widget: defaults to "item"
{% endcomment %}
{% load aircox %}
{% with timetable|default:False as timetable %}
{% with widget|default:"item" as widget %}
{% for object in object_list %}
{% if object.episode %}
{% page_widget widget object.episode diffusion=object timetable=True %}
{% elif object|is_log %}
{% include "./track_item.html" with object=object.track log=object timetable=True %}
{% else %}
<div class="preview list-item logs">
<header class="headings">
<span class="heading title">
<span class="icon pr-2">
<i class="fas fa-music"></i>
</span>
{{ station.music_stream_title }}
</span>
</header>
<div class="media d-block content">
{% for obj in object %}
{% include "./track_item.html" with object=obj.track log=obj timetable=True %}
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}
{% endwith %}
{% endwith %}

View File

@ -0,0 +1,50 @@
{% load aircox i18n %}
<div class="dropdown is-hoverable is-right">
<div class="dropdown-trigger">
<button class="button square" aria-haspopup="true" aria-controls="dropdown-menu" type="button">
<span class="icon">
<i class="fa fa-user" aria-hidden="true"></i>
</span>
</button>
</div>
<div class="dropdown-menu" id="dropdown-menu" role="menu" style="z-index:200">
<div class="dropdown-content">
{% block user-menu %}
<a class="dropdown-item" href="{% url "dashboard" %}" data-force-reload="1">
{% translate "Dashboard" %}
</a>
{% if user|has_perm:"list_user" %}
<a class="dropdown-item" href="{% url "user-list" %}" data-force-reload="1">
{% translate "Users" %}
</a>
{% endif %}
{% endblock %}
{% comment %}
{% block edit-menu %}
{% if request.user|has_perm:"aircox.create_program" %}
<a class="dropdown-item" href="{% url "program-create" %}">
{% translate "Create Program" %}
</a>
{% endif %}
{% endblock %}
{% endcomment %}
{% if user.is_superuser %}
<hr class="dropdown-divider" />
{% block admin-menu %}
<a class="dropdown-item" href="{% url "admin:index" %}" target="new">
{% translate "Admin" %}
</a>
<a class="dropdown-item" href="{% url "dashboard-statistics" %}">
{% translate "Statistics" %}
</a>
{% endblock %}
<hr class="dropdown-divider" />
{% endif %}
<a class="dropdown-item" href="{% url "logout" %}" data-force-reload="1">
{% translate "Disconnect" %}
</a>
</div>
</div>
</div>

View File

@ -0,0 +1,38 @@
{% extends widget_template %}
{% load i18n aircox %}
{% block outer %}
{% with cover|default:object.cover_url as cover %}
{% with url|default:object.get_absolute_url as url %}
{{ block.super }}
{% endwith %}
{% endwith %}
{% endblock %}
{% block title %}
{% if title %}
{{ block.super }}
{% elif object %}
{{ object.display_title }}
{% endif %}
{% endblock %}
{% block content %}
{% if not content and object %}
{% with object.display_headline as content %}
{{ block.super }}
{% endwith %}
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}
{% block actions %}
{% if url and "card" not in widget_template %}
<a href="{{ url }}">{% translate "Show" %}</a>
{% endif %}
{{ block.super }}
{% endblock %}

View File

@ -0,0 +1,33 @@
{% load aircox i18n %}
{% block user-actions-container %}
{% if user.is_authenticated %}
{{ object.get_status_display }}
{% if object.pub_date %}
({{ object.pub_date|date:"d/m/Y H:i" }})
{% endif %}
{% endif %}
{% if user.is_authenticated and can_edit %}
{% with request.resolver_match.view_name as view_name %}
&nbsp;
{% if "-edit" in view_name %}
<a href="{% url view_name|detail_view page.slug %}" target="_self" title="{% translate 'View' %} {{ page }}">
<span class="icon">
<i class="fa-regular fa-eye"></i>
</span>
<span>{% translate 'View' %} </span>
</a>
{% else %}
<a href="{% url view_name|edit_view page.pk %}" target="_self" title="{% translate 'Edit' %} {{ page }}">
<span class="icon">
<i class="fa-solid fa-pencil"></i>
</span>
<span>{% translate 'Edit' %} </span>
</a>
{% endif %}
{% endwith %}
{% endif %}
{% endblock %}

View File

@ -0,0 +1,13 @@
{% extends widget|default:"./card.html" %}
{% block outer %}
{% if object %}
{% with content=object.get_display_excerpt() %}
{% with title=object.get_display_title() %}
{{ block.super }}
{% endwith %}
{% endwith %}
{% else %}
{{ block.super }}
{% endif %}
{% endblock %}

View File

@ -3,3 +3,11 @@
{% block card_title %}
{% block title %}{{ block.super }}{% endblock %}
{% endblock %}
{% block card_subtitle %}
{% block subtitle %}{{ block.super }}{% endblock %}
{% endblock %}
{% block card_class %}
{% block class %}{{ block.super }}{% endblock %}
{% endblock %}

View File

@ -5,10 +5,10 @@ Context:
- object_list: object list
- list_url: url to complete list page
{% endcomment %}
{% load i18n %}
{% load i18n aircox %}
{% for object in object_list %}
{% include object.item_template_name %}
{% page_widget "item" object %}
{% endfor %}
{% if list_url %}

View File

@ -5,7 +5,7 @@ The audio player
<br>
<div class="box is-fullwidth is-fixed-bottom is-paddingless player"
<div class="is-fullwidth is-fixed-bottom is-paddingless player-container"
role="{% translate "player" %}"
aria-description="{% translate "Audio player used to listen to the radio and podcasts" %}">
<noscript>
@ -20,26 +20,32 @@ The audio player
<a-player ref="player"
:live-args="{% player_live_attr %}"
:playlists="{pin: ['{% translate "Bookmarks" %}', 'fa fa-star'], queue: ['{% translate 'Playlist' %}', 'fa fa-list']}"
button-title="{% translate "Play or pause audio" %}">
<template v-slot:content="{ loaded, live, current }">
<h4 v-if="loaded" class="title is-4">
[[ loaded.name ]]
<h4 v-if="loaded" class="title">
<a v-if="current?.data?.page_url" :href="current.data.page_url">
[[ loaded.name ]]
</a>
<template v-else>[[ loaded.name ]]</template>
</h4>
<h4 v-else-if="current && current.data.type == 'track'"
class="title is-4" aria-description="{% translate "Track currently on air" %}">
<span class="has-text-info is-size-3">&#9836;</span>
class="title" aria-description="{% translate "Track currently on air" %}">
<span class="icon secondary-color mr-3">
<i class="fas fa-music"></i>
</span>
<span>[[ current.data.title ]]</span>
<span class="has-text-grey-dark has-text-weight-light">
&mdash; [[ current.data.artist ]]
<i v-if="current.data.info">([[ current.data.info ]])</i>
</span>
</h4>
<div v-else-if="live && current && current.data.type == 'diffusion'">
<h4 class="title is-4" aria-description="{% translate "Diffusion currently on air" %}">
<a :href="current.data.url">[[ current.data.title ]]</a>
<h4 v-else-if="live && current && current.data.type == 'diffusion'"
class="title"
aria-description="{% translate "Diffusion currently on air" %}">
<a :href="current.data.url" v-if="current.data.url">[[ current.data.title ]]</a>
<template v-else>[[ current.data.title ]]</template>
</h4>
<div class="">[[ current.data.info ]]</div>
</div>
<h4 v-else class="title is-4" aria-description="{% translate "Currently playing" %}">
{{ request.station.name }}
</h4>

View File

@ -0,0 +1,70 @@
{% load i18n %}
{% comment %}
Content related context:
- object: object to display
- cover: cover
- title: title
- subtitle: subtitle
- content: content to display
Components:
- no_cover: don't show cover
- no_content: don't show content
Styling related context:
- is_active: add "active" css class
- is_small: add "small" css class
- is_tiny: add "tiny" css class
- tag
- tag_class: css class to set to main tag
- tag_extra: extra tag attributes
{% endcomment %}
{% load aircox %}
{% block outer %}
<{{ tag|default:"article" }} id="{{ object|object_id }}" class="preview {% if not cover %}no-cover {% endif %}{% if is_active %}active {% endif %}{% if is_tiny %}tiny{% elif is_small %}small{% endif %}{% block tag-class %}{{ tag_class|default:"" }} {% endblock %}" {% block tag-extra %}{% endblock %}>
{% block inner %}
{% block headings-container %}
<header class="headings{% block headings-class %}{% endblock %}"{% block headings-tag-extra %}{% endblock %}>
{% block headings %}
{% block title-container %}
<a href="{{ url|escape }}" class="heading title {% block title-class %}{% endblock %}"{% if title %} title="{{ title|escape }}"{% endif %}>
{% block title %}{{ title|default:"" }}{% endblock %}
</a>
{% endblock %}
{% block subtitle-container %}
<span class="heading subtitle {% block subtitle-class %}{% endblock %}">
{% block subtitle %}{{ subtitle|default:"" }}{% endblock %}
</span>
{% endblock %}
{% endblock %}
</header>
{% endblock %}
{% block content-container %}
<section class="content headings-container">
{% block content %}
{% if content and not no_content %}
{% autoescape off %}
{{ content|striptags|linebreaks }}
{% endautoescape %}
{% endif %}
{% endblock %}
</section>
{% endblock %}
{% block actions-container %}
{% spaceless %}
<div class="actions">
{% block actions %}
{% if admin and object.edit_url_name %}
<a href="{% url object.edit_url_name pk=object.pk %}">{% translate "Edit" %}</a>
{% endif %}
{% endblock %}
</div>
{% endspaceless %}
{% endblock %}
{% endblock %}
</{{ tag|default:"article" }}>
{% endblock %}

View File

@ -5,9 +5,20 @@ Context:
- object: track to render
{% endcomment %}
<span class="has-text-info is-size-5">&#9836;</span>
<span>{{ object.title }}</span>
<span class="has-text-grey-dark has-text-weight-light">
&mdash; {{ object.artist }}
{% if object.info %}(<i>{{ object.info }}</i>){% endif %}
<span class="track">
<span class="icon secondary-color">
<i class="fas fa-music"></i>
</span>
<label>
{% if log %}
<span>{{ log.date|date:"H:i" }} &mdash; </span>
{% endif %}
<span class="has-text-weight-boldk">{{ object.title }}</span>
{% if object.artist and object.artist != object.title %}
<span>
&mdash; {{ object.artist }}
{% if object.info %}(<i>{{ object.info }}</i>){% endif %}
</span>
{% endif %}
</label>
</span>

View File

@ -0,0 +1,43 @@
{% extends "./preview.html" %}
{% load i18n aircox %}
{% block tag-class %}{{ block.super }} list-item wide is-fullwidth{% endblock %}
{% block headings %}
<a href="{{ url|escape }}" class="heading title {% block title-class %}{% endblock %}">
{% block title %}{{ title|default:"" }}{% endblock %}
</a>
<span class="heading subtitle {% block subtitle-class %}{% endblock %}">
{% block subtitle %}{{ subtitle|default:"" }}{% endblock %}
</span>
{% endblock %}
{% block inner %}
{% block content-container %}
<div class="media">
{% if object.cover %}
<a href="{{ object.get_absolute_url }}"
class="media-left preview-cover"
style="background-image: url({{ object.cover.url }})">
</a>
{% endif %}
<div class="media-content">
{% block headings-container %}{{ block.super }}{% endblock %}
<section class="content">
{% block content %}
{% if content and with_content %}
{% autoescape off %}
{{ content|striptags|linebreaks }}
{% endautoescape %}
{% endif %}
{% endblock %}
</section>
{% block actions-container %}
{{ block.super }}
{% endblock %}
</div>
{% endblock %}
{% endblock %}