work on logs, timetable, stats

This commit is contained in:
bkfox
2019-09-08 01:39:40 +02:00
parent 2d21ab2434
commit c68e21ee57
71 changed files with 19683 additions and 710 deletions

View File

@ -1,12 +1,67 @@
{% extends "admin/base_site.html" %}
{% load i18n %}
{% load i18n aircox %}
{% block content %}{{ block.super }}
<table class="table">
{# TODO: date subtitle #}
<a-statistics>
<template v-slot:default="{counts}">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<th>{% trans "time" %}</th>
<th>{% trans "episode" %}</th>
<th>{% trans "track" %}</th>
<th>{% trans "tags" %}</th>
</tr>
</thead>
<tbody>
{% for object in object_list %}
{% with object|get_tracks as tracks %}
{% for track in tracks %}
<tr>
{% if forloop.first %}
<td rowspan="{{ tracks|length }}">{{ object.start|time:"H:i" }}</td>
<td rowspan="{{ tracks|length }}">{{ object.episode|default:"" }}</td>
{% endif %}
</table>
{% if not object|is_diffusion %}
{% with track as object %}
<td>{% include "aircox/track_item.html" %}</td>
{% endwith %}
{% with track.tags.all|join:', ' as tags %}
<td>
{% if tags %}
<label class="checkbox">
<input type="checkbox" checked value="{{ tags|escape }}" name="data">
{{ tags }}
</label>
{% endif %}
</td>
{% endwith %}
{% else %}
{% endif %}
{% endfor %}
<tr>
{% endwith %}
{% endfor %}
</tbody>
<tfoot>
<tr>
<td class="is-size-6">{% trans "Totals" %}</td>
<td colspan="100">
<div class="columns is-size-6">
<span v-for="(count, tag) in counts" class="column">
<b>[[ tag ]]</b>
[[ count ]]
</span>
</div>
</td>
</tr>
</tfoot>
</table>
</template>
</a-statistics>
{% endblock %}

View File

@ -8,6 +8,9 @@
<link rel="stylesheet" type="text/css" href="{% static "aircox/main.css" %}">
<link rel="stylesheet" type="text/css" href="{% static "aircox/admin.css" %}">
<script src="{% static "aircox/vendor.js" %}"></script>
<script src="{% static "aircox/admin.js" %}"></script>
{% block extrastyle %}{% endblock %}
{% if LANGUAGE_BIDI %}<link rel="stylesheet" type="text/css" href="{% block stylesheet_rtl %}{% static "admin/css/rtl.css" %}{% endblock %}">{% endif %}
@ -26,7 +29,7 @@
data-admin-utc-offset="{% now "Z" %}">
<!-- Container -->
<div id="container">
<div id="app">
{% if not is_popup %}
<!-- Header -->
@ -59,16 +62,16 @@
</div>
</div>
</div>
<div class="navbar-end">
<div class="navbar-item has-dropdown is-hoverable">
<a href="#" class="navbar-link">{% trans "Tools" %}</a>
<div class="navbar-dropdown is-boxed is-right">
<a href="{% url 'admin:tools-stats' %}" class="navbar-item">{% trans "Statistics" %}</a>
</div>
</div>
</div>
<div class="navbar-end">
<div class="navbar-item has-dropdown is-hoverable">
<a href="{% url "admin:auth_user_change" user.pk %}" class="navbar-link">
{% firstof user.get_short_name user.get_username %}

View File

@ -14,10 +14,10 @@ Context:
<link rel="icon" href="{% thumbnail site.favicon 32x32 crop %}" />
{% block assets %}
<link rel="stylesheet" type="text/css" href="{% static "aircox/main.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "aircox/vendor.css" %}"/>
<script src="{% static "aircox/main.js" %}"></script>
<link rel="stylesheet" type="text/css" href="{% static "aircox/main.css" %}"/>
<script src="{% static "aircox/vendor.js" %}"></script>
<script src="{% static "aircox/main.js" %}"></script>
{% endblock %}
<title>
@ -55,14 +55,19 @@ Context:
{% block header %}
<h1 class="title is-1">{% block title %}{% endblock %}</h1>
<h3 class="subtitle is-3 columns">
{% block subtitle %}
{% if parent %}
<a href="{{ parent.get_absolute_url }}" class="column">
&#10092; {{ parent.title }}</a></li>
{% endif %}
{% endblock %}
<h3 class="subtitle is-3">
{% block subtitle %}{% endblock %}
</h3>
<div class="columns is-size-4">
{% block header_meta %}
{% if parent %}
<a href="{{ parent.get_absolute_url }}" class="column">
&#10092; {{ parent.title }}</a></li>
{% endif %}
{% endblock %}
</div>
{% endblock %}
</header>

View File

@ -0,0 +1,44 @@
{% extends "aircox/page.html" %}
{% load i18n aircox %}
{% block title %}
{% with station.name as station %}
{% blocktrans %}Today on {{ station }}{% endblocktrans %}
{% endwith %}
{% endblock %}
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
{% block main %}{{ block.super }}
<div class="columns">
{% with True as hide_schedule %}
<section class="column">
<div id="timetable-{{ date|date:"Y-m-d" }}">
{% for diffusion in object_list %}
<div class="columns">
<div class="column is-one-fifth has-text-right">
<time datetime="{{ diffusion.start|date:"c" }}">
{{ diffusion.start|date:"H:i" }} - {{ diffusion.end|date:"H:i" }}
</time>
</div>
<div class="column">
{% with diffusion.episode as object %}
{% include "aircox/episode_item.html" %}
{% endwith %}
</div>
</div>
{% endfor %}
</div>
</section>
{% endwith %}
<nav class="column menu is-one-third-desktop" role="menu">
{% with "diffusion-list" as url_name %}
{% include "aircox/widgets/dates_menu.html" %}
{% endwith %}
</nav>
</div>
{% endblock %}

View File

@ -1,62 +0,0 @@
{% extends "aircox/page.html" %}
{% load i18n aircox %}
{% block title %}
{% with station.name as station %}
{% blocktrans %}This week's shows... {% endblocktrans %}
{% endwith %}
{% endblock %}
{% block subtitle %}
<div class="column">
{% blocktrans %}From <b>{{ start }}</b> to <b>{{ end }}</b>{% endblocktrans %}
</div>
{% endblock %}
{% block main %}{{ block.super }}
{% with True as hide_schedule %}
<section>
{% unique_id "timetable" as timetable_id %}
<a-tabs default="{{ date }}">
<template v-slot:tabs="scope" noscript="hidden">
<li><a href="{% url "timetable" date=prev_date %}">&#10092; {% trans "Before" %}</a></li>
{% for day in by_date.keys %}
<a-tab value="{{ day }}">
<a href="{% url "timetable" date=day %}">
{{ day|date:"D. d" }}
</a>
</a-tab>
{% endfor %}
<li>
<a href="{% url "timetable" date=next_date %}">{% trans "After" %} &#10093;</a>
</li>
</template>
<template v-slot:default="{value}">
{% for day, diffusions in by_date.items %}
<noscript><h4 class="subtitle is-4">{{ day|date:"l d F Y" }}</h4></noscript>
<div id="{{timetable_id}}-{{ day|date:"Y-m-d" }}" v-if="value == '{{ day }}'">
{% for diffusion in diffusions %}
<div class="columns">
<div class="column is-one-fifth has-text-right">
<time datetime="{{ diffusion.start|date:"c" }}">
{{ diffusion.start|date:"H:i" }} - {{ diffusion.end|date:"H:i" }}
</time>
</div>
<div class="column">
{% with diffusion.episode as object %}
{% include "aircox/episode_item.html" %}
{% endwith %}
</div>
</div>
{% endfor %}
</div>
{% endfor %}
</template>
</a-tabs>
</section>
{% endwith %}
{% endblock %}

View File

@ -16,13 +16,8 @@ for design review.
{% endwith %}
{% endwith %}
{% else %}
{% with object.track as track %}
<span class="has-text-info is-size-5">&#9836;</span>
<span>{{ track.title }}</span>
<span class="has-text-grey-dark has-text-weight-light">
&mdash; {{ track.artist }}
{% if track.info %}(<i>{{ track.info }}</i>){% endif %}
</span>
{% with object.track as object %}
{% include "aircox/track_item.html" %}
{% endwith %}
{% endif %}

View File

@ -1,31 +1,20 @@
{% extends "aircox/page.html" %}
{% load i18n aircox %}
{% load i18n humanize aircox %}
{% block title %}
{% trans "Logs" %}
{% with station.name as station %}
{% blocktrans %}That happened on {{ station }}{% endblocktrans %}
{% endwith %}
{% endblock %}
{% block subtitle %}{{ date|date:"l d F Y" }}{% endblock %}
{% block main %}
<section class="section">
{% if dates %}
<nav class="tabs is-medium is-centered" aria-label="{% trans "Other days' logs" %}">
<ul>
{% for day in dates %}
<li {% if day == date %}class="is-active"{% endif %}>
<a href="{% url "logs" date=day %}">
{{ day|date:"d b" }}
</a>
</li>
{% if forloop.last and day > min_date %}
<li>...</li>
{% endif %}
{% endfor %}
</ul>
</nav>
{% endif %}
<div class="columns">
<section class="section column">
{# <h4 class="subtitle size-4">{{ date }}</h4> #}
{% with True as hide_schedule %}
<table class="table is-striped is-hoverable is-fullwidth has-background-transparent">
@ -48,5 +37,13 @@
</table>
{% endwith %}
</section>
<nav class="column menu is-one-third-desktop" role="menu">
{% with "logs" as url_name %}
{% include "aircox/widgets/dates_menu.html" %}
{% endwith %}
</nav>
</div>
{% endblock %}

View File

@ -6,12 +6,11 @@ Context:
- page: page
{% endcomment %}
{% block subtitle %}
{{ block.super }}
{% if page.category %}
{% block header_meta %}{{ block.super }}
<span class="column has-text-right">{{ object.category.title }}</span>
{% endif %}
{% endblock %}
{% endif %}
{% block main %}
@ -51,7 +50,9 @@ Context:
{% for field in comment_form %}
<div class="field is-horizontal">
<div class="field-label is-normal">
<label class="label">{{ field.label_tag }}</label>
<label class="label">
{{ field.label_tag }}
</label>
</div>
<div class="field-body">
<div class="field">

View File

@ -4,9 +4,8 @@
<br>
<div class="box is-fullwidth is-fixed-bottom is-paddingless player"
aria-role="{% trans "player" %}"
aria-description="{% trans "audio player used to listen to streams and podcasts" %}"
>
role="{% trans "player" %}"
aria-description="{% trans "audio player used to listen to the radio" %}">
<noscript>
<audio src="{{ audio_streams.0 }}" controls>
{% for stream in audio_streams %}
@ -18,7 +17,7 @@
<a-player ref="player" src="{{ audio_streams.0 }}"
live-info-url="{% url "api-live" %}" :live-info-timeout="15"
button-title="{% trans "Play/pause audio" %}">
button-title="{% trans "Play or pause audio" %}">
<template v-slot:sources>
{% for stream in audio_streams %}
<source src="{{ stream }}" />

View File

@ -16,7 +16,7 @@
<nav class="pagination is-centered">
<ul class="pagination-list">
<li>
<a href="{% url "diffusion-list" parent_slug=program.slug %}"
<a href="{% url "episode-list" parent_slug=program.slug %}"
class="pagination-link"
aria-label="{% trans "Show all program's diffusions" %}">
{% trans "More shows" %}

View File

@ -0,0 +1,12 @@
{% comment %}
Context:
- object: track to render
{% endcomment %}
<span class="has-text-info is-size-5">&#9836;</span>
<span>{{ track.title }}</span>
<span class="has-text-grey-dark has-text-weight-light">
&mdash; {{ track.artist }}
{% if track.info %}(<i>{{ track.info }}</i>){% endif %}
</span>

View File

@ -0,0 +1,48 @@
{% comment %}
Render a navigation menu for dates
Context:
- url_name: url name
- date: current date
- input_type: date input type
- dates: dates to display as a list of `(date|None, title|None)`.
An empty date results to a title or a separator
{% endcomment %}
{% load i18n humanize %}
<nav class="menu is-one-third-desktop " role="menu"
aria-label="{% trans "pick a date" %}">
<p class="menu-label">{% trans "Pick a date" %}</p>
<form action="{% url url_name %}" method="GET"
aria-label="{% trans "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">
<button class="button is-primary">{% trans "Go" %}</button>
</div>
</div>
</form>
<ul class="menu-list">
{% for day, title in dates %}
{% if not day %}
{% if title %}
</ul>
<p class="menu-label">{{ title }}</p>
<ul class="menu-list">
{% else %}<hr class="dropdown-divider">{% endif %}
{% else %}
<li><a href="{% url url_name date=day %}" {% if day == date %}class="is-active"{% endif %}>
{% if title %}{{ title }}{% else %}{{ day|naturalday:"l d" }}{% endif %}
</a></li>
{% endif %}
{% endfor %}
</ul>
</nav>