Refactors dashboard warnings

This cleans up the display so that they don't get all squished when a
bunch are present, and creates a layout to make them more DRY
This commit is contained in:
Mouse Reeve 2022-07-08 11:29:15 -07:00
parent e35ce82052
commit 4a2e191d92
7 changed files with 100 additions and 51 deletions

View file

@ -38,60 +38,23 @@
<div class="columns block is-multiline">
{% if email_config_error %}
<div class="column is-flex">
<span class="notification is-warning is-block is-flex-grow-1">
{% blocktrans trimmed %}
Your outgoing email address, <code>{{ email_sender }}</code>, may be misconfigured.
{% endblocktrans %}
{% trans "Check the <code>EMAIL_SENDER_NAME</code> and <code>EMAIL_SENDER_DOMAIN</code> in your <code>.env</code>." %}
</span>
</div>
{% endif %}
{% if reports %}
<div class="column is-flex">
<a href="{% url 'settings-reports' %}" class="notification is-warning is-block is-flex-grow-1">
{% blocktrans trimmed count counter=reports with display_count=reports|intcomma %}
{{ display_count }} open report
{% plural %}
{{ display_count }} open reports
{% endblocktrans %}
</a>
</div>
{% endif %}
{% if pending_domains %}
<div class="column is-flex">
<a href="{% url 'settings-link-domain' %}" class="notification is-primary is-block is-flex-grow-1">
{% blocktrans trimmed count counter=pending_domains with display_count=pending_domains|intcomma %}
{{ display_count }} domain needs review
{% plural %}
{{ display_count }} domains need review
{% endblocktrans %}
</a>
</div>
{% endif %}
{% if not site.allow_registration and site.allow_invite_requests and invite_requests %}
<div class="column is-flex">
<a href="{% url 'settings-invite-requests' %}" class="notification is-block is-success is-flex-grow-1">
{% blocktrans trimmed count counter=invite_requests with display_count=invite_requests|intcomma %}
{{ display_count }} invite request
{% plural %}
{{ display_count }} invite requests
{% endblocktrans %}
</a>
</div>
{% include 'settings/dashboard/warnings/email_config.html' with warning_level="danger" fullwidth=True %}
{% endif %}
{% if current_version %}
<div class="column is-flex">
<a href="https://docs.joinbookwyrm.com/updating.html" class="notification is-block is-warning is-flex-grow-1" target="_blank">
{% blocktrans trimmed with current=current_version available=available_version %}
An update is available! You're running v{{ current }} and the latest release is {{ available }}.
{% endblocktrans %}
</a>
</div>
{% include 'settings/dashboard/warnings/update_version.html' with warning_level="warning" fullwidth=True %}
{% endif %}
{% if reports %}
{% include 'settings/dashboard/warnings/reports.html' with warning_level="warning" %}
{% endif %}
{% if pending_domains %}
{% include 'settings/dashboard/warnings/domain_review.html' with warning_level="primary" %}
{% endif %}
{% if not site.allow_registration and site.allow_invite_requests and invite_requests %}
{% include 'settings/dashboard/warnings/invites.html' with warning_level="success" %}
{% endif %}
</div>

View file

@ -0,0 +1,17 @@
{% extends 'settings/dashboard/warnings/layout.html' %}
{% load i18n %}
{% load humanize %}
{% block warning_link %}
{% url 'settings-link-domain' %}
{% endblock %}
{% block warning_text %}
{% blocktrans trimmed count counter=pending_domains with display_count=pending_domains|intcomma %}
{{ display_count }} domain needs review
{% plural %}
{{ display_count }} domains need review
{% endblocktrans %}
{% endblock %}

View file

@ -0,0 +1,15 @@
{% extends 'settings/dashboard/warnings/layout.html' %}
{% load i18n %}
{% block warning_link %}
https://docs.joinbookwyrm.com/install-prod.html
{% endblock %}
{% block warning_text %}
{% blocktrans trimmed %}
Your outgoing email address, <code>{{ email_sender }}</code>, may be misconfigured.
{% endblocktrans %}
{% trans "Check the <code>EMAIL_SENDER_NAME</code> and <code>EMAIL_SENDER_DOMAIN</code> in your <code>.env</code> file." %}
{% endblock %}

View file

@ -0,0 +1,17 @@
{% extends 'settings/dashboard/warnings/layout.html' %}
{% load i18n %}
{% load humanize %}
{% block warning_link %}
{% url 'settings-invite-requests' %}
{% endblock %}
{% block warning_text %}
{% blocktrans trimmed count counter=invite_requests with display_count=invite_requests|intcomma %}
{{ display_count }} invite request
{% plural %}
{{ display_count }} invite requests
{% endblocktrans %}
{% endblock %}

View file

@ -0,0 +1,6 @@
<div class="column is-flex{% if fullwidth %} is-12{% endif %}">
<a href="{% block warning_link %}{% endblock %}" class="notification is-{{ warning_level }} is-block is-flex-grow-1">
{% block warning_text %}{% endblock %}
</a>
</div>

View file

@ -0,0 +1,17 @@
{% extends 'settings/dashboard/warnings/layout.html' %}
{% load i18n %}
{% load humanize %}
{% block warning_link %}
{% url 'settings-reports' %}
{% endblock %}
{% block warning_text %}
{% blocktrans trimmed count counter=reports with display_count=reports|intcomma %}
{{ display_count }} open report
{% plural %}
{{ display_count }} open reports
{% endblocktrans %}
{% endblock %}

View file

@ -0,0 +1,14 @@
{% extends 'settings/dashboard/warnings/layout.html' %}
{% load i18n %}
{% block warning_link %}
https://docs.joinbookwyrm.com/updating.html
{% endblock %}
{% block warning_text %}
{% blocktrans trimmed with current=current_version available=available_version %}
An update is available! You're running v{{ current }} and the latest release is {{ available }}.
{% endblocktrans %}
{% endblock %}