forked from rc/aircox
feat: add error message page; improve admin ui; add missing test files
This commit is contained in:
@ -65,7 +65,10 @@
|
||||
<div class="navbar-start">
|
||||
{# Today's diffusions #}
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<span class="navbar-link">{% translate "Today" %}</span>
|
||||
<span class="icon-text navbar-link">
|
||||
<span class="icon"><i class="fa-regular fa-calendar-days"></i></span>
|
||||
<span>{% translate "Today" %}</span>
|
||||
</span>
|
||||
<div class="navbar-dropdown is-boxed">
|
||||
{% for diffusion in diffusions %}
|
||||
<a class="navbar-item {% if diffusion.is_now %}has-background-primary{% endif %}" href="{% url "admin:aircox_episode_change" diffusion.episode.pk %}">
|
||||
@ -76,23 +79,12 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Programs #}
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link" href="{% url "admin:aircox_program_changelist" %}">{% translate "Programs" %}</a>
|
||||
<div class="navbar-dropdown is-boxed">
|
||||
<input type="text" onkeyup="aircox.filter_menu(event)"
|
||||
placeholder="{% translate "Search" %}" class="navbar-item input" />
|
||||
<hr class="navbar-divider"/>
|
||||
{% for program in programs %}
|
||||
<a class="navbar-item" href="{% url "admin:aircox_program_change" program.pk %}">
|
||||
{{ program.title }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Articles #}
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link" href="{% url "admin:aircox_article_changelist" %}">{% translate "Articles" %}</a>
|
||||
<a class="icon-text navbar-link" href="{% url "admin:aircox_article_changelist" %}">
|
||||
<span class="icon"><i class="fa fa-newspaper"></i></span>
|
||||
<span>{% translate "Articles" %}</span>
|
||||
</a>
|
||||
<div class="navbar-dropdown is-boxed">
|
||||
<input type="text" onkeyup="aircox.filter_menu(event)"
|
||||
placeholder="{% translate "Search" %}" class="navbar-item input" />
|
||||
@ -104,9 +96,29 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Programs #}
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="icon-text navbar-link" href="{% url "admin:aircox_program_changelist" %}">
|
||||
<span class="icon"><i class="fa fa-folder"></i></span>
|
||||
<span>{% translate "Programs" %}</span>
|
||||
</a>
|
||||
<div class="navbar-dropdown is-boxed">
|
||||
<input type="text" onkeyup="aircox.filter_menu(event)"
|
||||
placeholder="{% translate "Search" %}" class="navbar-item input" />
|
||||
<hr class="navbar-divider"/>
|
||||
{% for program in programs %}
|
||||
<a class="navbar-item" href="{% url "admin:aircox_program_change" program.pk %}">
|
||||
{{ program.title }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{# Episodes #}
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link" href="{% url "admin:aircox_episode_changelist" %}">{% translate "Episodes" %}</a>
|
||||
<a class="icon-text navbar-link" href="{% url "admin:aircox_episode_changelist" %}">
|
||||
<span class="icon"><i class="fa fa-calendar-check"></i></span>
|
||||
<span>{% translate "Episodes" %}</span>
|
||||
</a>
|
||||
<div class="navbar-dropdown is-boxed">
|
||||
<input type="text" onkeyup="aircox.filter_menu(event)"
|
||||
placeholder="{% translate "Search" %}" class="navbar-item input" />
|
||||
@ -121,7 +133,10 @@
|
||||
|
||||
<div class="navbar-end">
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a href="#" class="navbar-link">{% translate "Tools" %}</a>
|
||||
<a href="#" class="icon-text navbar-link">
|
||||
<span class="icon"><i class="fa-solid fa-screwdriver-wrench"></i></span>
|
||||
<span>{% translate "Tools" %}</span>
|
||||
</a>
|
||||
<div class="navbar-dropdown is-boxed is-right">
|
||||
{% get_admin_tools as admin_tools %}
|
||||
{% for label, url in admin_tools %}
|
||||
@ -131,8 +146,9 @@
|
||||
</div>
|
||||
|
||||
<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 %}
|
||||
<a href="{% url "admin:auth_user_change" user.pk %}" class="icon-text navbar-link">
|
||||
<span class="icon"><i class="fa fa-user"></i></span>
|
||||
<span>{% firstof user.get_short_name user.get_username %}</span>
|
||||
</a>
|
||||
<div class="navbar-dropdown is-boxed is-right">
|
||||
{% block userlinks %}
|
||||
@ -179,16 +195,18 @@
|
||||
|
||||
<!-- Content -->
|
||||
<div id="app">
|
||||
<div id="content" class="{% block coltype %}colM{% endblock %}">
|
||||
{% block pretitle %}{% endblock %}
|
||||
{% block content_title %}{% if title %}<h1 class="title is-3">{{ title }}</h1>{% endif %}{% endblock %}
|
||||
{% block content %}
|
||||
{% block object-tools %}{% endblock %}
|
||||
{{ content }}
|
||||
{% block app %}
|
||||
<div id="content" class="{% block coltype %}colM{% endblock %}">
|
||||
{% block pretitle %}{% endblock %}
|
||||
{% block content_title %}{% if title %}<h1 class="title is-3">{{ title }}</h1>{% endif %}{% endblock %}
|
||||
{% block content %}
|
||||
{% block object-tools %}{% endblock %}
|
||||
{{ content }}
|
||||
{% endblock %}
|
||||
{% block sidebar %}{% endblock %}
|
||||
<br class="clear">
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block sidebar %}{% endblock %}
|
||||
<br class="clear">
|
||||
</div>
|
||||
</div>
|
||||
<!-- END Content -->
|
||||
|
||||
@ -197,7 +215,9 @@
|
||||
<!-- END Container -->
|
||||
|
||||
{% block player %}
|
||||
{% if request.station %}
|
||||
<div id="player">{% include "aircox/widgets/player.html" %}</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
</body>
|
||||
|
@ -2,92 +2,92 @@
|
||||
{% load i18n thumbnail %}
|
||||
|
||||
|
||||
{% block messages %}
|
||||
{{ block.super }}
|
||||
|
||||
{% block app %}
|
||||
<div class="section">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<h1 class="title is-4">{% translate "Today" %}</h1>
|
||||
<table class="table is-fullwidth is-striped">
|
||||
<tbody>
|
||||
{% for diffusion in diffusions %}
|
||||
{% with episode=diffusion.episode %}
|
||||
<tr {% if diffusion.is_now %}class="is-selected"{% endif %}>
|
||||
<td>{{ diffusion.start|time }} - {{ diffusion.end|time }}</td>
|
||||
<td><img src="{% thumbnail episode.cover 64x64 crop %}"/></td>
|
||||
<td>
|
||||
<a href="{% url "admin:aircox_episode_change" episode.pk %}">{{ episode.title }}</a>
|
||||
|
||||
{% 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>
|
||||
<div class="box">
|
||||
<h1 class="title icon-text is-4">
|
||||
<span class="icon"><i class="fa-regular fa-calendar-days"></i></span>
|
||||
<span>{% translate "Today" %}</span>
|
||||
</h1>
|
||||
{% if diffusions %}
|
||||
<table class="table is-fullwidth is-striped">
|
||||
<tbody>
|
||||
{% for diffusion in diffusions %}
|
||||
{% with episode=diffusion.episode %}
|
||||
<tr {% if diffusion.is_now %}class="is-selected"{% endif %}>
|
||||
<td>{{ diffusion.start|time }} - {{ diffusion.end|time }}</td>
|
||||
<td><img src="{% thumbnail episode.cover 64x64 crop %}"/></td>
|
||||
<td>
|
||||
<a href="{% url "admin:aircox_episode_change" episode.pk %}">{{ episode.title }}</a>
|
||||
|
||||
{{ 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 %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="column">
|
||||
<h1 class="title is-4">{% translate "Latest comments" %}</h1>
|
||||
<table class="table is-fullwidth is-striped">
|
||||
{% for comment in comments %}
|
||||
{% with page=comment.page %}
|
||||
<tr>
|
||||
<th>
|
||||
{{ page.title }}
|
||||
</a>
|
||||
|
|
||||
<span title="{{ comment.email }}">{{ comment.nickname }}</span>
|
||||
—
|
||||
<span>{{ comment.date }}</span>
|
||||
<span class="float-right">
|
||||
<a href="{% url "admin:aircox_comment_change" comment.pk %}"
|
||||
title="{% translate "Edit comment" %}"
|
||||
aria-label="{% translate "Edit comment" %}">
|
||||
<span class="fa fa-edit"></span>
|
||||
</a>
|
||||
<a class="has-text-danger"
|
||||
title="{% translate "Delete comment" %}"
|
||||
aria-label="{% translate "Delete comment" %}"
|
||||
href="{% url "admin:aircox_comment_delete" comment.pk %}">
|
||||
<span class="fa fa-trash-alt"></span>
|
||||
</a>
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
{{ comment.content|slice:"0:128" }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="has-text-centered">
|
||||
<a href="{% url "admin:aircox_comment_changelist" %}" class="float-center">{% translate "All comments" %}</a>
|
||||
{% 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>
|
||||
|
||||
{{ 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 %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="block has-text-centered">
|
||||
{% trans "No diffusion is scheduled for today." %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="box">
|
||||
<h1 class="title is-4 icon-text">
|
||||
<span class="icon"><i class="fa-regular fa-comments"></i></span>
|
||||
<span>{% translate "Latest comments" %}</span>
|
||||
</h1>
|
||||
{% if comments %}
|
||||
{% include "aircox/widgets/page_list.html" with object_list=comments with_title=True %}
|
||||
<div class="has-text-centered">
|
||||
<a href="{% url "admin:aircox_comment_changelist" %}" class="float-center">{% translate "All comments" %}</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="block has-text-centered">{% trans "No comment posted yet" %}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="column">
|
||||
<div class="box">
|
||||
<h1 class="title is-4 icon-text">
|
||||
<span class="icon"><i class="fa-regular fa-newspaper"></i></span>
|
||||
<span>{% translate "Latest publications" %}</span>
|
||||
</h1>
|
||||
{% if latests %}
|
||||
{% include "aircox/widgets/page_list.html" with object_list=latests no_actions=True %}
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="box">
|
||||
<h1 class="title is-4 icon-text">
|
||||
<span class="icon"><i class="fa fa-screwdriver-wrench"></i></span>
|
||||
<span>{% translate "Administration" %}</span>
|
||||
</h1>
|
||||
{% include "admin/app_list.html" with app_list=app_list show_changelinks=True %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -48,6 +48,7 @@ Usefull context:
|
||||
})
|
||||
</script>
|
||||
<div id="app">
|
||||
{% block top-nav-container %}
|
||||
<nav class="navbar has-shadow" role="navigation" aria-label="main navigation">
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
@ -84,6 +85,7 @@ Usefull context:
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{% endblock %}
|
||||
|
||||
<div class="container">
|
||||
<div class="columns is-desktop">
|
||||
@ -161,6 +163,8 @@ Usefull context:
|
||||
|
||||
<hr>
|
||||
</div>
|
||||
{% block player-container %}
|
||||
<div id="player">{% include "aircox/widgets/player.html" %}</div>
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
30
aircox/templates/aircox/errors/base.html
Normal file
30
aircox/templates/aircox/errors/base.html
Normal file
@ -0,0 +1,30 @@
|
||||
{% extends "aircox/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block top-nav-container %}
|
||||
{% if request.station %}{{ block.super }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block player-container %}
|
||||
{% if request.station %}{{ block.super }}{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block head_title %}
|
||||
{% block title %}{% trans "An error occurred..." %}{% endblock %}
|
||||
{% if request.station %}
|
||||
—
|
||||
{{ station.name }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block content %}
|
||||
<article class="message is-danger">
|
||||
<div class="message-header">
|
||||
<p>{% block error_title %}{% trans "An error occurred" %}{% endblock %}</p>
|
||||
</div>
|
||||
<div class="message-body">
|
||||
{% block error_content %}{% endblock %}
|
||||
</div>
|
||||
</article>
|
||||
{% endblock %}
|
22
aircox/templates/aircox/errors/no_station.html
Normal file
22
aircox/templates/aircox/errors/no_station.html
Normal file
@ -0,0 +1,22 @@
|
||||
{% extends "aircox/errors/base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block error_title %}{% trans "No station is configured" %}{% endblock %}
|
||||
|
||||
{% block error_content %}
|
||||
{% blocktranslate %}It seems there is no station configured for this website:{% endblocktranslate %}
|
||||
|
||||
<ul>
|
||||
<li>
|
||||
{% trans "If you are the website administrator, please connect to administration interface." %}
|
||||
<a href="{% url "admin:login" %}">
|
||||
{% trans "Go to admin" %}
|
||||
<span class="icon"><i class="fa fa-external-link"></i></span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
{% trans "If you are a visitor, please contact your favorite radio" %}
|
||||
<span class="icon text-danger"><i class="fa fa-heart"></i></span>
|
||||
</li>
|
||||
</ul>
|
||||
{% endblock %}
|
@ -66,6 +66,8 @@ Context variables:
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if not no_actions %}
|
||||
{% block actions %}{% endblock %}
|
||||
{% endif %}
|
||||
</article>
|
||||
{% endif %}
|
||||
|
41
aircox/templates/aircox/widgets/comment_item.html
Normal file
41
aircox/templates/aircox/widgets/comment_item.html
Normal file
@ -0,0 +1,41 @@
|
||||
{% load i18n %}
|
||||
<article class="media item {% block css %}{% endblock%}">
|
||||
<div class="media-content">
|
||||
{% if request.user.is_staff %}
|
||||
<span class="float-right">
|
||||
<a href="{% url "admin:aircox_comment_change" object.pk %}"
|
||||
title="{% trans "Edit comment" %}"
|
||||
aria-label="{% trans "Edit comment" %}">
|
||||
<span class="fa fa-edit"></span>
|
||||
</a>
|
||||
<a class="has-text-danger"
|
||||
title="{% trans "Delete comment" %}"
|
||||
aria-label="{% trans "Delete comment" %}"
|
||||
href="{% url "admin:aircox_comment_delete" object.pk %}">
|
||||
<span class="fa fa-trash-alt"></span>
|
||||
</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if with_title %}
|
||||
<h5 class="title is-5 has-text-weight-normal">
|
||||
{% block title %}
|
||||
<a href="{{ object.get_absolute_url }}">{{ object.parent.title }}</a>
|
||||
{% endblock %}
|
||||
</h5>
|
||||
{% endif %}
|
||||
<div class="subtitle is-6 has-text-weight-light">
|
||||
{% block subtitle %}
|
||||
{% if request.user.is_staff %}
|
||||
<a href="mailto:{{ object.email }}">{{ object.nickname }}</a>
|
||||
{% else %}
|
||||
{{ object.nickname }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
—
|
||||
{{ object.date }}
|
||||
</div>
|
||||
<div class="headline">
|
||||
{% block headline %}{{ object.content }}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
Reference in New Issue
Block a user