diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 4e8a1db1678cf3e37325b8144bf62f886efaf0d1..d6294abcf9bc0931526b1dd2419d817679c57bde 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_. `2.0b2` - 2021-06-15 -------------------- +Added +~~~~~~~ + +* Add option to disable dashboard auto updating as a user and sitewide. + Changed ~~~~~~~ diff --git a/aleksis/core/preferences.py b/aleksis/core/preferences.py index 2dc131eadf7de27b0979bbf347ea4320346701c9..588992f60d4e396450b05fc7d4a9e2978f196a45 100644 --- a/aleksis/core/preferences.py +++ b/aleksis/core/preferences.py @@ -386,3 +386,23 @@ 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") diff --git a/aleksis/core/templates/core/index.html b/aleksis/core/templates/core/index.html index b2c1f3f5f9375d23ccc19297c5876f4c215e5bc4..cfc5d72141cf0aaddf879fc4888a5277eccc4fa1 100644 --- a/aleksis/core/templates/core/index.html +++ b/aleksis/core/templates/core/index.html @@ -108,5 +108,7 @@ </div> {% endif %} - <script type="text/javascript" src="{% static "js/include_ajax_live.js" %}"></script> + {% 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 %}