Adding in course messaging to the home page.

LEARNER-1894

This commit adds in course messaging for three use cases. First,
when the user is not signed in, the user is shown a message that
provides a link to sign in or register. If the user is signed in
but not enrolled, they are given a link to do so. If the user is
enrolled but the course has not yet started, they are shown a
message explaining when the course starts and shown a link (not
yet enabled) to add a reminder to their calendar.

The implementation defines a base message class and extends it
for the course home messages as well as the previously implemented
page level messages.
This commit is contained in:
Harry Rein
2017-07-17 13:25:34 -04:00
parent 27cd3d199d
commit 08df53e110
16 changed files with 471 additions and 118 deletions

View File

@@ -7,12 +7,7 @@ from django.http import HttpResponseNotFound
from django.utils.translation import ugettext as _
from edxmako.shortcuts import render_to_response
from mako.exceptions import TopLevelLookupException
from openedx.core.djangoapps.util.user_messages import (
register_error_message,
register_info_message,
register_success_message,
register_warning_message,
)
from openedx.core.djangoapps.util.user_messages import PageLevelMessages
def show_reference_template(request, template):
@@ -40,10 +35,10 @@ def show_reference_template(request, template):
# Add some messages to the course skeleton pages
if u'course-skeleton.html' in request.path:
register_info_message(request, _('This is a test message'))
register_success_message(request, _('This is a success message'))
register_warning_message(request, _('This is a test warning'))
register_error_message(request, _('This is a test error'))
PageLevelMessages.register_info_message(request, _('This is a test message'))
PageLevelMessages.register_success_message(request, _('This is a success message'))
PageLevelMessages.register_warning_message(request, _('This is a test warning'))
PageLevelMessages.register_error_message(request, _('This is a test error'))
return render_to_response(template, context)
except TopLevelLookupException: