From 96dc83f50e2520ece30eed1e93459eb9ae970cc7 Mon Sep 17 00:00:00 2001 From: MizukiTemma Date: Tue, 19 Nov 2024 18:31:49 +0100 Subject: [PATCH] Add popup for information about page access statistics --- integreat_cms/cms/fixtures/test_data.json | 11 ++ ...11_add_statistics_tutorial_seen_to_user.py | 25 +++++ integreat_cms/cms/models/users/user.py | 7 ++ .../templates/generic_tutorial_dialog.html | 2 +- .../cms/templates/pages/page_tree.html | 2 +- .../statistics/statistics_overview.html | 5 + .../tutorials/page_access_statistics.html | 38 +++++++ .../cms/views/pages/page_tree_view.py | 1 + .../views/settings/dismiss_tutorial_view.py | 2 + .../cms/views/statistics/statistics_view.py | 1 + integreat_cms/locale/de/LC_MESSAGES/django.po | 101 ++++++++++++++++-- .../release_notes/current/unreleased/3132.yml | 2 + 12 files changed, 188 insertions(+), 9 deletions(-) create mode 100644 integreat_cms/cms/migrations/0111_add_statistics_tutorial_seen_to_user.py create mode 100644 integreat_cms/cms/templates/tutorials/page_access_statistics.html create mode 100644 integreat_cms/release_notes/current/unreleased/3132.yml diff --git a/integreat_cms/cms/fixtures/test_data.json b/integreat_cms/cms/fixtures/test_data.json index 11d6daf26e..115af29cbc 100644 --- a/integreat_cms/cms/fixtures/test_data.json +++ b/integreat_cms/cms/fixtures/test_data.json @@ -1701,6 +1701,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1727,6 +1728,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1753,6 +1755,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1779,6 +1782,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1805,6 +1809,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1831,6 +1836,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1857,6 +1863,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1883,6 +1890,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1909,6 +1917,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1935,6 +1944,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, @@ -1961,6 +1971,7 @@ "chat_last_visited": "0001-01-01T00:00:00Z", "expert_mode": true, "page_tree_tutorial_seen": true, + "statistics_tutorial_seen": true, "distribute_sidebar_boxes": false, "totp_key": null, "passwordless_authentication_enabled": false, diff --git a/integreat_cms/cms/migrations/0111_add_statistics_tutorial_seen_to_user.py b/integreat_cms/cms/migrations/0111_add_statistics_tutorial_seen_to_user.py new file mode 100644 index 0000000000..06ffdc8464 --- /dev/null +++ b/integreat_cms/cms/migrations/0111_add_statistics_tutorial_seen_to_user.py @@ -0,0 +1,25 @@ +# Generated by Django 4.2.16 on 2024-11-19 16:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + """ + Migration to add a new field statistics_tutorial_seen to User model + """ + + dependencies = [ + ("cms", "0110_region_zammad_webhook_token_alter_region_zammad_url"), + ] + + operations = [ + migrations.AddField( + model_name="user", + name="statistics_tutorial_seen", + field=models.BooleanField( + default=False, + help_text="Will be set to true once the user dismissed the tutorial for page access statistics", + verbose_name="Page access statistics tutorial seen", + ), + ), + ] diff --git a/integreat_cms/cms/models/users/user.py b/integreat_cms/cms/models/users/user.py index 851dbf00ff..8f49251a6b 100644 --- a/integreat_cms/cms/models/users/user.py +++ b/integreat_cms/cms/models/users/user.py @@ -110,6 +110,13 @@ class User(AbstractUser, AbstractBaseModel): "Will be set to true once the user dismissed the page tree tutorial" ), ) + statistics_tutorial_seen = models.BooleanField( + default=False, + verbose_name=_("Page access statistics tutorial seen"), + help_text=_( + "Will be set to true once the user dismissed the tutorial for page access statistics" + ), + ) distribute_sidebar_boxes = models.BooleanField( default=False, verbose_name=_("automatically distribute sidebar boxes"), diff --git a/integreat_cms/cms/templates/generic_tutorial_dialog.html b/integreat_cms/cms/templates/generic_tutorial_dialog.html index 074f1a5903..af99d30ffd 100644 --- a/integreat_cms/cms/templates/generic_tutorial_dialog.html +++ b/integreat_cms/cms/templates/generic_tutorial_dialog.html @@ -17,7 +17,7 @@ + {% if tutorial_seen %}checked{% endif %} /> {% translate "Don't show again" %}
@@ -17,5 +21,6 @@

+ {% include "../tutorials/page_access_statistics.html" with tutorial_id="page-access-statistics-info" hidden=tutorial_seen %} {% endblock content %} {% endif %} diff --git a/integreat_cms/cms/templates/tutorials/page_access_statistics.html b/integreat_cms/cms/templates/tutorials/page_access_statistics.html new file mode 100644 index 0000000000..b8882edd08 --- /dev/null +++ b/integreat_cms/cms/templates/tutorials/page_access_statistics.html @@ -0,0 +1,38 @@ +{% extends "../generic_tutorial_dialog.html" %} +{% load i18n %} +{% load static %} +{% block content %} + +
+

+ {% translate "Important information about page access" %} +

+
+ +
+

+ {% translate "There is a text here that helps employees to interpret the numbers and statistics appropriately." %} +

+ +

+ {% translate "You can find more information about this in " %}{% translate "Wiki" %} +

+
+{% endblock content %} diff --git a/integreat_cms/cms/views/pages/page_tree_view.py b/integreat_cms/cms/views/pages/page_tree_view.py index 19430164dc..70e5157358 100644 --- a/integreat_cms/cms/views/pages/page_tree_view.py +++ b/integreat_cms/cms/views/pages/page_tree_view.py @@ -154,5 +154,6 @@ def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: currently_in_translation=True, ).count() > 0, + "tutorial_seen": request.user.page_tree_tutorial_seen, }, ) diff --git a/integreat_cms/cms/views/settings/dismiss_tutorial_view.py b/integreat_cms/cms/views/settings/dismiss_tutorial_view.py index e59073e19f..30d2e1d98a 100644 --- a/integreat_cms/cms/views/settings/dismiss_tutorial_view.py +++ b/integreat_cms/cms/views/settings/dismiss_tutorial_view.py @@ -31,6 +31,8 @@ def post(self, request: HttpRequest, *args: Any, **kwargs: Any) -> JsonResponse: if (tutorial_slug := kwargs.get("slug")) == "page-tree": request.user.page_tree_tutorial_seen = True + elif (tutorial_slug := kwargs.get("slug")) == "page-access-statistics-info": + request.user.statistics_tutorial_seen = True else: return JsonResponse( {"error": f"Tutorial '{tutorial_slug}' not found."}, status=404 diff --git a/integreat_cms/cms/views/statistics/statistics_view.py b/integreat_cms/cms/views/statistics/statistics_view.py index 6b6fd47aac..7d900748a6 100644 --- a/integreat_cms/cms/views/statistics/statistics_view.py +++ b/integreat_cms/cms/views/statistics/statistics_view.py @@ -63,5 +63,6 @@ def get( { **self.get_context_data(**kwargs), "form": form, + "tutorial_seen": request.user.statistics_tutorial_seen, }, ) diff --git a/integreat_cms/locale/de/LC_MESSAGES/django.po b/integreat_cms/locale/de/LC_MESSAGES/django.po index a08bc2bca6..15e00d50f7 100644 --- a/integreat_cms/locale/de/LC_MESSAGES/django.po +++ b/integreat_cms/locale/de/LC_MESSAGES/django.po @@ -2337,8 +2337,8 @@ msgid "" "A Zammad URL, Zammad Webhook Token and Access Token are required in order to " "enable the Integreat Chat." msgstr "" -"Eine Zammad URL, ein Zammad Webhook Token und ein Zugangstoken sind erforderlich um, den Integreat " -"Chat aktivieren." +"Eine Zammad URL, ein Zammad Webhook Token und ein Zugangstoken sind " +"erforderlich um, den Integreat Chat aktivieren." #: cms/forms/regions/region_form.py msgid "" @@ -4236,8 +4236,8 @@ msgid "" "webhook path." msgstr "" "Token der von Zammad Webhooks verwendet wird, um das Integreat CMS über " -"geänderte Tickets zu informieren. Der Token muss als token= GET parameter dem " -"Webhook-Pfad angefügt werden." +"geänderte Tickets zu informieren. Der Token muss als token= GET parameter " +"dem Webhook-Pfad angefügt werden." #: cms/models/regions/region.py msgid "Zammad chat handlers" @@ -4353,6 +4353,18 @@ msgstr "" "Wird auf wahr gesetzt, wenn der:die Benutzer:in das Tutorial zum Seitenbaum " "angesehen hat" +#: cms/models/users/user.py +msgid "Page access statistics tutorial seen" +msgstr "Seitenzugriff-Tutorial angesehen" + +#: cms/models/users/user.py +msgid "" +"Will be set to true once the user dismissed the tutorial for page access " +"statistics" +msgstr "" +"Wird auf wahr gesetzt, wenn der:die Benutzer:in das Tutorial zum " +"Seitezugriff angesehen hat" + #: cms/models/users/user.py msgid "automatically distribute sidebar boxes" msgstr "Sidebar-Boxen automatisch verteilen" @@ -8538,6 +8550,84 @@ msgstr "Summe pro Art des Inhalts" msgid "Total per Status" msgstr "Summe pro Status" +#: cms/templates/tutorials/page_access_statistics.html +msgid "Important information about page access" +msgstr "Wichtige Hinweise zu Seitenzugriffen" + +#: cms/templates/tutorials/page_access_statistics.html +msgid "" +"There is a text here that helps employees to interpret the numbers and " +"statistics appropriately." +msgstr "" +"Hier steht ein Text, der Mitarbeiter:innen dabei hilft, die Zahlen und " +"Statistiken angemessen interpretieren zu können." + +#: cms/templates/tutorials/page_access_statistics.html +msgid "" +"Offline access cannot be counted. This means that even a page with few hits " +"in the list can have higher hits that took place offline." +msgstr "" +"Offline-Zugriffe können nicht mitgerechnet werden. D.h. auch eine Seite mit " +"wenigen Zugriffen in der Liste kann höhere Zugriffe haben, die offline " +"stattgefunden haben." + +#: cms/templates/tutorials/page_access_statistics.html +msgid "" +"Pages that contain specific information about seasonal or one-time events (e." +"g. events or election times) may receive higher traffic during certain " +"periods. Outside these phases, traffic may be lower." +msgstr "" +"Seiten, die spezifische Informationen zu saisonalen oder einmaligen " +"Ereignissen enthalten (z.B. Veranstaltungen oder Wahlzeiten), können in " +"bestimmten Phasen höhere Zugriffszahlen aufweisen. Außerhalb dieser Phasen " +"sind die Zugriffe eventuell niedriger." + +#: cms/templates/tutorials/page_access_statistics.html +msgid "" +"Page views should not be viewed in isolation, but always in the context of " +"the overall communication strategy. A page with few hits can still be an " +"important part of user guidance and information." +msgstr "" +"Seitenzugriffe sollten nicht isoliert betrachtet werden, sondern immer im " +"Kontext der gesamten Kommunikationsstrategie. Eine Seite mit wenigen " +"Zugriffen kann trotzdem ein wichtiger Bestandteil der Nutzerführung und " +"Information sein." + +#: cms/templates/tutorials/page_access_statistics.html +msgid "" +"Some pages may be rarely visited, but are extremely important for specific " +"target groups (e.g. newcomers, people with special needs). For example, " +"information about special advisory services or integration offers could not " +"be used by the general public, but could be indispensable for the target " +"group." +msgstr "" +"Manche Seiten werden möglicherweise selten besucht, sind aber für " +"spezifische Zielgruppen (z.B. Neuankömmlinge, Menschen mit besonderen " +"Bedürfnissen) extrem wichtig. Zum Beispiel könnten Informationen über " +"spezielle Beratungsdienste oder Integrationsangebote nicht von der breiten " +"Masse genutzt werden, aber für die Zielgruppe unverzichtbar sein." + +#: cms/templates/tutorials/page_access_statistics.html +msgid "" +"Content that is no longer current or appears outdated can lead to a decrease " +"in traffic. It is therefore important to regularly check whether content has " +"been updated and how this affects the statistics. Low traffic numbers could " +"indicate that the page is no longer perceived as relevant." +msgstr "" +"Inhalte, die nicht mehr aktuell sind oder veraltet erscheinen, können zu " +"einem Rückgang der Zugriffe führen. Es ist daher wichtig, regelmäßig zu " +"überprüfen, ob Inhalte aktualisiert wurden und wie dies die Statistiken " +"beeinflusst. Niedrige Zugriffszahlen könnten darauf hinweisen, dass die " +"Seite nicht mehr als relevant wahrgenommen wird." + +#: cms/templates/tutorials/page_access_statistics.html +msgid "You can find more information about this in " +msgstr "Mehr Informationen dazu finden Sie im" + +#: cms/templates/tutorials/page_access_statistics.html +msgid "Wiki" +msgstr "Wiki" + #: cms/templates/tutorials/page_tree.html msgid "Introduction - Page Tree" msgstr "Einführung in den neuen Seiten-Baum" @@ -11248,9 +11338,6 @@ msgstr "" #~ msgid "Import calendar" #~ msgstr "Kalender importieren" -#~ msgid "Find more information about this" -#~ msgstr "Mehr Informationen finden Sie" - #~ msgid "" #~ "Easy words and short sentences can increase the text understandability." #~ msgstr "" diff --git a/integreat_cms/release_notes/current/unreleased/3132.yml b/integreat_cms/release_notes/current/unreleased/3132.yml new file mode 100644 index 0000000000..762f145f5e --- /dev/null +++ b/integreat_cms/release_notes/current/unreleased/3132.yml @@ -0,0 +1,2 @@ +en: Add popup with information about page access statistics +de: Füge Popup mit Informationen über die Zugriffsstatistiken hinzu