feat: add error message page; improve admin ui; add missing test files

This commit is contained in:
bkfox
2023-09-12 21:00:44 +02:00
parent a0468899b0
commit 876e4cdfa7
28 changed files with 1242 additions and 438 deletions

View File

@ -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>

View 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 %}
&mdash;
{{ 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 %}

View 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 %}

View File

@ -66,6 +66,8 @@ Context variables:
{% endif %}
</div>
{% if not no_actions %}
{% block actions %}{% endblock %}
{% endif %}
</article>
{% endif %}

View 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 %}
&mdash;
{{ object.date }}
</div>
<div class="headline">
{% block headline %}{{ object.content }}{% endblock %}
</div>
</div>
</article>