diff --git a/aleksis/core/preferences.py b/aleksis/core/preferences.py index 4e1bd8a40744e8374a3c3df041b2832da3f7275d..b05539ad7175621cc9842af8fcf53ec47203c9cc 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 6bbbab8ecfbe2768d12eb139fae110ac5cf62371..7c0cfaf1f681c0bcfbbbb4d4cd5ac2121c8634d4 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