diff --git a/analytics_dashboard/settings/base.py b/analytics_dashboard/settings/base.py index 71f1f982d..e9c84a00b 100644 --- a/analytics_dashboard/settings/base.py +++ b/analytics_dashboard/settings/base.py @@ -230,6 +230,7 @@ 'courses', 'django_rjs', 'help', + 'soapbox', ) # See: https://docs.djangoproject.com/en/dev/ref/settings/#installed-apps diff --git a/analytics_dashboard/templates/_announcement.html b/analytics_dashboard/templates/_announcement.html new file mode 100644 index 000000000..1f7b32e29 --- /dev/null +++ b/analytics_dashboard/templates/_announcement.html @@ -0,0 +1,34 @@ +{% load i18n %} + +
+
+
+ + +
+ {% if message %} + {{ message|safe }} + {% else %} +
+

{{ title }}

+

{{ body|safe }}

+
+ {% endif %} +
+ + {% if dismiss_url %} +
+ {% csrf_token %} + + + {% trans "Close" %} + +
+ {% endif %} +
+
+
diff --git a/analytics_dashboard/templates/announcements.html b/analytics_dashboard/templates/announcements.html index 65cbb0479..01e160b3f 100644 --- a/analytics_dashboard/templates/announcements.html +++ b/analytics_dashboard/templates/announcements.html @@ -1,32 +1,14 @@ -{% load announcements_tags i18n %} +{% load soapbox %} +{% load announcements_tags %} -{% announcements as announcements_list %} +{% get_messages_for_page view.page_name as soapbox_messages %} +{% for message in soapbox_messages %} + {% include "_announcement.html" with message=message %} +{% endfor %} +{% announcements as announcements_list %} {% with announcements_list|first as announcement %} {% if announcement %} -
-
- {% csrf_token %} - - {% trans "Close" %} - - -
-
-
-
-
- -
-
-
{{ announcement.title }}
-
{{ announcement.content|safe }}
-
-
-
-
-
-
+ {% include "_announcement.html" with body=announcement.content title=announcement.title dismiss_url=announcement.dismiss_url %} {% endif %} {% endwith %} diff --git a/requirements/base.txt b/requirements/base.txt index addf23573..7a01e3723 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -7,6 +7,7 @@ django_compressor==1.4 # MIT django-countries==3.1.1 # MIT django-libsass==0.2 # BSD django-model-utils==1.5.0 # BSD +django-soapbox==1.1 # BSD django-waffle==0.10 # BSD # other versions cause a segment fault when running compression