From ede55403352c575854c2b7295909ff8f0a2ad0f2 Mon Sep 17 00:00:00 2001 From: Peter Pfeufer Date: Sun, 26 May 2024 16:46:03 +0200 Subject: [PATCH] [ADD] Widget title partial to AA framework --- .../authentication/dashboard_characters.html | 12 +-- .../authentication/dashboard_groups.html | 6 +- .../framework/dashboard/widget-title.html | 8 ++ .../templates/optimer/dashboard.ops.html | 57 ++++++----- .../allianceauth/admin-status/overview.html | 85 ++++++++-------- .../timerboard/dashboard.timers.html | 98 +++++++++---------- .../development/custom/framework/templates.md | 21 ++++ 7 files changed, 154 insertions(+), 133 deletions(-) create mode 100644 allianceauth/framework/templates/framework/dashboard/widget-title.html diff --git a/allianceauth/authentication/templates/authentication/dashboard_characters.html b/allianceauth/authentication/templates/authentication/dashboard_characters.html index 83075233..7021ba46 100644 --- a/allianceauth/authentication/templates/authentication/dashboard_characters.html +++ b/allianceauth/authentication/templates/authentication/dashboard_characters.html @@ -1,13 +1,11 @@ {% load i18n %}
-
+
-
-

- {% translate "Characters" %} -

-
-
+ {% translate "Characters" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} + +
diff --git a/allianceauth/authentication/templates/authentication/dashboard_groups.html b/allianceauth/authentication/templates/authentication/dashboard_groups.html index 39acde52..270fcb76 100644 --- a/allianceauth/authentication/templates/authentication/dashboard_groups.html +++ b/allianceauth/authentication/templates/authentication/dashboard_groups.html @@ -2,8 +2,10 @@
-

{% translate "Membership" %}

-
+ {% translate "Membership" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} + +
{% translate "State:" %} {{ request.user.profile.state }}
diff --git a/allianceauth/framework/templates/framework/dashboard/widget-title.html b/allianceauth/framework/templates/framework/dashboard/widget-title.html new file mode 100644 index 00000000..fdc11845 --- /dev/null +++ b/allianceauth/framework/templates/framework/dashboard/widget-title.html @@ -0,0 +1,8 @@ +{#Usage:#} +{# {% include "framework/dashboard/widget-title.html" with title="Foobar" %}#} + +
+

+ {{ title }} +

+
diff --git a/allianceauth/optimer/templates/optimer/dashboard.ops.html b/allianceauth/optimer/templates/optimer/dashboard.ops.html index 93c49e36..cf990ec4 100644 --- a/allianceauth/optimer/templates/optimer/dashboard.ops.html +++ b/allianceauth/optimer/templates/optimer/dashboard.ops.html @@ -4,38 +4,37 @@
-

{% translate "Upcoming Fleets" %}

+ {% translate "Upcoming Fleets" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} -
-
-
- +
+
+ + + + + + + + + + + {% for ops in timers %} - - - - + + + + - - - - {% for ops in timers %} - - - - - - - {% endfor %} - -
{% translate "Operation" %}{% translate "Type" %}{% translate "Form Up System" %}{% translate "EVE Time" %}
{% translate "Operation" %}{% translate "Type" %}{% translate "Form Up System" %}{% translate "EVE Time" %} + {{ ops.operation_name }} + + {{ ops.type }} + + {{ ops.system }} + {{ ops.start | date:"Y-m-d H:i" }}
- {{ ops.operation_name }} - - {{ ops.type }} - - {{ ops.system }} - {{ ops.start | date:"Y-m-d H:i" }}
-
+ {% endfor %} + +
diff --git a/allianceauth/templates/allianceauth/admin-status/overview.html b/allianceauth/templates/allianceauth/admin-status/overview.html index fe2f5a29..23e4c026 100644 --- a/allianceauth/templates/allianceauth/admin-status/overview.html +++ b/allianceauth/templates/allianceauth/admin-status/overview.html @@ -5,45 +5,40 @@
-
-
-

- {% translate "Alliance Auth Notifications" %} -

+ {% translate "Alliance Auth Notifications" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} -
@@ -53,13 +48,12 @@
-
+
-

- {% translate "Software Version" %} -

+ {% translate "Software Version" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} -
+
  • @@ -98,11 +92,10 @@
    -

    - {% translate "Task Queue" %} -

    + {% translate "Task Queue" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} -
    +

    {% blocktranslate with total=tasks_total|intcomma latest=earliest_task|timesince|default:"?" %} Status of {{ total }} processed tasks • last {{ latest }} diff --git a/allianceauth/timerboard/templates/timerboard/dashboard.timers.html b/allianceauth/timerboard/templates/timerboard/dashboard.timers.html index 181ab24d..d512e483 100644 --- a/allianceauth/timerboard/templates/timerboard/dashboard.timers.html +++ b/allianceauth/timerboard/templates/timerboard/dashboard.timers.html @@ -4,56 +4,56 @@

    -

    {% translate "Upcoming Timers" %}

    -
    -
    - - - - - - - - - - + {% translate "Upcoming Timers" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} - - {% for timer in timers %} - - - - - - - - {% endfor %} - -
    {% translate "Details" %}{% translate "Timer" %}{% translate "Type" %}{% translate "System" %}{% translate "EVE Time" %}
    - {{ timer.details }} - - {{ timer.get_timer_type_display }} - - {% if timer.objective == "Hostile" %} -
    - {% translate "Hostile" %} -
    - {% endif %} - {% if timer.objective == "Friendly" %} -
    - {% translate "Friendly" %} -
    - {% endif %} - {% if timer.objective == "Neutral" %} -
    - {% translate "Neutral" %} -
    - {% endif %} -
    - {{ timer.system }} {{ timer.planet_moon }} - - {{ timer.eve_time | date:"Y-m-d H:i" }}
    -
    +
    + + + + + + + + + + + + + {% for timer in timers %} + + + + + + + + {% endfor %} + +
    {% translate "Details" %}{% translate "Timer" %}{% translate "Type" %}{% translate "System" %}{% translate "EVE Time" %}
    + {{ timer.details }} + + {{ timer.get_timer_type_display }} + + {% if timer.objective == "Hostile" %} +
    + {% translate "Hostile" %} +
    + {% endif %} + {% if timer.objective == "Friendly" %} +
    + {% translate "Friendly" %} +
    + {% endif %} + {% if timer.objective == "Neutral" %} +
    + {% translate "Neutral" %} +
    + {% endif %} +
    + {{ timer.system }} {{ timer.planet_moon }} + + {{ timer.eve_time | date:"Y-m-d H:i" }}
    diff --git a/docs/development/custom/framework/templates.md b/docs/development/custom/framework/templates.md index b2308032..b7581a8c 100644 --- a/docs/development/custom/framework/templates.md +++ b/docs/development/custom/framework/templates.md @@ -28,6 +28,27 @@ To ensure a unified style language throughout Alliance Auth and Community Apps, we also provide a couple of template partials. This collection is bound to grow over time, so best have an eye on this page. +### Dashboard Widget Title + +To ensure the dashboard widgets have a unified style, we provide a template partial for the widget title. + +To use it, you can use the following code in your dashboard widget template: + +```django +
    +
    +
    + {% translate "My Widget Title" as widget_title %} + {% include "framework/dashboard/widget-title.html" with title=widget_title %} + +
    +

    My widget content

    +
    +
    +
    +
    +``` + ### Page Header On some pages you want to have a page header. To make this easier, we provide a template partial for this.