From 1190b37026e32e8c3b18c7145b608f5bc8ab7324 Mon Sep 17 00:00:00 2001 From: Lloyd Meins <git@lloydmeins.de> Date: Fri, 4 Jun 2021 13:44:21 +0200 Subject: [PATCH] Add preferences to disable dashboard auto updating --- aleksis/core/preferences.py | 19 +++++++++++++++++++ aleksis/core/templates/core/index.html | 8 +++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/aleksis/core/preferences.py b/aleksis/core/preferences.py index 4e1bd8a40..b05539ad7 100644 --- a/aleksis/core/preferences.py +++ b/aleksis/core/preferences.py @@ -386,3 +386,22 @@ class PDFFileExpirationDuration(IntegerPreference): default = 3 verbose_name = _("PDF file expiration duration") help_text = _("in minutes") + + +@person_preferences_registry.register +class AutoUpdatingDashboard(BooleanPreference): + """User preference for automatically updating the dashboard.""" + + section = general + name = "automatically_update_dashboard" + default = True + verbose_name = _("Automatically update the dashboard and its widgets") + +@site_preferences_registry.register +class AutoUpdatingDashboardSite(BooleanPreference): + """Automatic updating of dashboard.""" + + section = general + name = "automatically_update_dashboard_site" + default = True + verbose_name = _("Automatically update the dashboard and its widgets sitewide") \ No newline at end of file diff --git a/aleksis/core/templates/core/index.html b/aleksis/core/templates/core/index.html index 6bbbab8ec..7c0cfaf1f 100644 --- a/aleksis/core/templates/core/index.html +++ b/aleksis/core/templates/core/index.html @@ -60,7 +60,7 @@ <div class="col s12 m6"> <h5>{% blocktrans %}Last activities{% endblocktrans %}</h5> - {% if activities %} + {% if activities %} sitewide <ul class="collection"> {% for activity in activities %} <li class="collection-item"> @@ -110,5 +110,7 @@ </div> {% endif %} - <script type="text/javascript" src="{% static "js/include_ajax_live.js" %}"></script> -{% endblock %} + {% if user.person.preferences.general__automatically_update_dashboard and request.site.preferences.general__automatically_update_dashboard_site %} + <script type="text/javascript" src="{% static "js/include_ajax_live.js" %}"></script> + {% endif %} +{% endblock %} \ No newline at end of file -- GitLab