Clean up dashboard widgets

This commit is contained in:
Jeremy Stretch 2024-01-02 14:49:25 -05:00
parent f746ab178d
commit 6fc83eb7e7
5 changed files with 69 additions and 74 deletions

View File

@ -115,46 +115,43 @@ Blocks:
<div class="page-wrapper">
{# Page header #}
<div class="page-header mt-2 d-print-none">
<div class="container-xl">
<div class="container-xl mt-2 d-print-none">
{% if config.BANNER_TOP %}
<div class="text-center mx-3">
{{ config.BANNER_TOP|safe }}
</div>
{% endif %}
{% if config.BANNER_TOP %}
<div class="text-center mx-3">
{{ config.BANNER_TOP|safe }}
{% if settings.DEBUG and not settings.DEVELOPER %}
<div class="alert alert-warning text-center mx-3" role="alert">
<strong><i class="mdi mdi-alert"></i> {% trans "Debug mode is enabled" %}.</strong>
{% trans "Performance may be limited. Debugging should never be enabled on a production system" %}.
</div>
{% endif %}
{% if config.MAINTENANCE_MODE and config.BANNER_MAINTENANCE %}
<div class="alert alert-warning text-center mx-3" role="alert">
<h5><i class="mdi mdi-alert"></i> {% trans "Maintenance Mode" %}</h5>
{{ config.BANNER_MAINTENANCE|escape }}
</div>
{% endif %}
{% block header %}
<div class="row align-items-center">
{# Title #}
<div class="col">
<h2 class="page-title">{% block title %}{% endblock title %}</h2>
{% block subtitle %}{% endblock %}
</div>
{% endif %}
{% if settings.DEBUG and not settings.DEVELOPER %}
<div class="alert alert-warning text-center mx-3" role="alert">
<strong><i class="mdi mdi-alert"></i> {% trans "Debug mode is enabled" %}.</strong>
{% trans "Performance may be limited. Debugging should never be enabled on a production system" %}.
{# Controls #}
<div class="col-auto ms-auto d-print-none">
{% block controls %}{% endblock controls %}
</div>
{% endif %}
{% if config.MAINTENANCE_MODE and config.BANNER_MAINTENANCE %}
<div class="alert alert-warning text-center mx-3" role="alert">
<h5><i class="mdi mdi-alert"></i> {% trans "Maintenance Mode" %}</h5>
{{ config.BANNER_MAINTENANCE|escape }}
</div>
{% endif %}
{% block header %}
<div class="row align-items-center">
{# Title #}
<div class="col">
<h2 class="page-title">{% block title %}{% endblock title %}</h2>
{% block subtitle %}{% endblock %}
</div>
{# Controls #}
<div class="col-auto ms-auto d-print-none">
{% block controls %}{% endblock controls %}
</div>
</div>
{% endblock header %}
</div>
</div>
{% endblock header %}
</div>
{# /Page header #}

View File

@ -9,32 +9,30 @@
gs-id="{{ widget.id }}"
>
<div class="card grid-stack-item-content">
<div class="card-header text-center text-{{ widget.fg_color }} bg-{{ widget.color|default:"secondary" }} p-1">
<div class="float-start ps-1">
<a href="#"
hx-get="{% url 'extras:dashboardwidget_config' id=widget.id %}"
hx-target="#htmx-modal-content"
data-bs-toggle="modal"
data-bs-target="#htmx-modal"
>
<i class="mdi mdi-cog text-{{ widget.fg_color }}"></i>
</a>
<div class="card-header text-{{ widget.fg_color }} bg-{{ widget.color|default:"secondary" }} px-2 py-1 d-flex flex-row">
<a href="#"
hx-get="{% url 'extras:dashboardwidget_config' id=widget.id %}"
hx-target="#htmx-modal-content"
data-bs-toggle="modal"
data-bs-target="#htmx-modal"
>
<i class="mdi mdi-cog text-{{ widget.fg_color }}"></i>
</a>
<div class="card-title flex-fill text-center">
{% if widget.title %}
<span class="fs-4 fw-bold">{{ widget.title }}</span>
{% endif %}
</div>
<div class="float-end pe-1">
<a href="#"
hx-get="{% url 'extras:dashboardwidget_delete' id=widget.id %}"
hx-target="#htmx-modal-content"
data-bs-toggle="modal"
data-bs-target="#htmx-modal"
>
<i class="mdi mdi-close text-{{ widget.fg_color }}"></i>
</a>
</div>
{% if widget.title %}
<strong>{{ widget.title }}</strong>
{% endif %}
<a href="#"
hx-get="{% url 'extras:dashboardwidget_delete' id=widget.id %}"
hx-target="#htmx-modal-content"
data-bs-toggle="modal"
data-bs-target="#htmx-modal"
>
<i class="mdi mdi-close text-{{ widget.fg_color }}"></i>
</a>
</div>
<div class="card-body p-2 overflow-auto">
<div class="card-body p-2 pt-1 overflow-auto">
{% render_widget widget %}
</div>
</div>

View File

@ -3,7 +3,7 @@
{% if bookmarks %}
<div class="list-group list-group-flush">
{% for bookmark in bookmarks %}
<a href="{{ bookmark.object.get_absolute_url }}" class="list-group-item list-group-item-action">
<a href="{{ bookmark.object.get_absolute_url }}" class="list-group-item list-group-item-action px-1 py-2">
{{ bookmark.object }}
</a>
{% endfor %}

View File

@ -1,20 +1,20 @@
{% load i18n %}
{% if counts %}
<div class="list-group list-group-flush">
{% for model, count, url in counts %}
{% if count != None %}
<a href="{{ url }}" class="list-group-item list-group-item-action">
<div class="d-flex w-100 justify-content-between align-items-center">
{{ model|meta:"verbose_name_plural"|bettertitle }}
<h6 class="mb-1">{{ count }}</h6>
</div>
</a>
{% else %}
<div class="list-group-item list-group-item-action d-flex w-100 justify-content-between align-items-center">
<a href="{{ url }}" class="list-group-item list-group-item-action px-1 py-2">
<div class="d-flex w-100 justify-content-between align-items-center">
{{ model|meta:"verbose_name_plural"|bettertitle }}
<h6 class="mb-1" title="{% trans "No permission" %}"><i class="mdi mdi-lock-outline"></i></h6>
{% if count is None %}
<span title="{% trans "No permission" %}">
<i class="mdi mdi-lock-outline"></i>
</span>
{% else %}
<strong>{{ count }}</strong>
{% endif %}
</div>
{% endif %}
</a>
{% endfor %}
</div>
{% endif %}

View File

@ -2,9 +2,9 @@
{% if feed and not feed.bozo %}
<div class="list-group list-group-flush">
{% for entry in feed.entries %}
<div class="list-group-item px-1">
<h6><a href="{{ entry.link }}">{{ entry.title }}</a></h6>
<div>
<div class="list-group-item px-1 py-2">
<a href="{{ entry.link }}" class="text-body">{{ entry.title }}</a>
<div class="text-secondary">
{{ entry.summary|safe }}
</div>
</div>