From b1ce012a94f2b4d61d0c7b8d908c498e3b087ddc Mon Sep 17 00:00:00 2001 From: Troy Sankey Date: Mon, 26 Mar 2018 10:42:41 -0400 Subject: [PATCH] move global status messages from the header to the user notification area --- .../migrations/0002_update_help_text.py | 19 ++++++++++++++++ common/djangoapps/status/models.py | 15 ++++++++++--- lms/templates/header/header.html | 17 -------------- lms/templates/navigation/navigation.html | 22 ------------------- lms/templates/page_banner.html | 10 ++++++++- 5 files changed, 40 insertions(+), 43 deletions(-) create mode 100644 common/djangoapps/status/migrations/0002_update_help_text.py diff --git a/common/djangoapps/status/migrations/0002_update_help_text.py b/common/djangoapps/status/migrations/0002_update_help_text.py new file mode 100644 index 0000000000..bebdacafe3 --- /dev/null +++ b/common/djangoapps/status/migrations/0002_update_help_text.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('status', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='globalstatusmessage', + name='message', + field=models.TextField(help_text=b'

The contents of this field will be displayed as a warning banner on all views.

To override the banner message for a specific course, refer to the Course Message configuration. Course Messages will only work if the global status message is enabled, so if you only want to add a banner to specific courses without adding a global status message, you should add a global status message with empty message text.

Finally, disable the global status message by adding another empty message with "enabled" unchecked.

', null=True, blank=True), + ), + ] diff --git a/common/djangoapps/status/models.py b/common/djangoapps/status/models.py index 2f6c5dc013..94dfe2fb36 100644 --- a/common/djangoapps/status/models.py +++ b/common/djangoapps/status/models.py @@ -14,7 +14,16 @@ class GlobalStatusMessage(ConfigurationModel): """ Model that represents the current status message. """ - message = models.TextField(blank=True, null=True) + message = models.TextField( + blank=True, + null=True, + help_text='

The contents of this field will be displayed as a warning banner on all views.

' + '

To override the banner message for a specific course, refer to the Course Message configuration. ' + 'Course Messages will only work if the global status message is enabled, so if you only want to add ' + 'a banner to specific courses without adding a global status message, you should add a global status ' + 'message with empty message text.

' + '

Finally, disable the global status message by adding another empty message with "enabled" ' + 'unchecked.

') def full_message(self, course_key): """ Returns the full status message, including any course-specific status messages. """ @@ -26,7 +35,7 @@ class GlobalStatusMessage(ConfigurationModel): if course_key: try: course_home_message = self.coursemessage_set.get(course_key=course_key) - # Don't add the message if course_home_message is blank. + # Don't override the message if course_home_message is blank. if course_home_message: msg = u"{}
{}".format(msg, course_home_message.message) except CourseMessage.DoesNotExist: @@ -41,7 +50,7 @@ class GlobalStatusMessage(ConfigurationModel): class CourseMessage(models.Model): """ - Model that allows the user to specify messages for individual courses. + Model that allows the administrator to specify banner messages for individual courses. This is not a ConfigurationModel because using it's not designed to support multiple configurations at once, which would be problematic if separate courses need separate error messages. diff --git a/lms/templates/header/header.html b/lms/templates/header/header.html index eb25c78897..c55556b2f1 100644 --- a/lms/templates/header/header.html +++ b/lms/templates/header/header.html @@ -13,8 +13,6 @@ from openedx.core.djangolib.markup import HTML, Text # App that handles subdomain specific branding from branding import api as branding_api -# app that handles site status messages -from status.status import get_site_status_msg from openedx.core.djangoapps.lang_pref.api import header_language_selector_is_enabled, released_languages %> @@ -30,21 +28,6 @@ from openedx.core.djangoapps.lang_pref.api import header_language_selector_is_en % endif -<%block> -<% -course_id = course.id if course else None -site_status_msg = get_site_status_msg(course_id) -%> -% if site_status_msg: -
-
- -

${site_status_msg}

-
-
-% endif - -