Add basic Bootstrap theme to Studio

LEARNER-1982
This commit is contained in:
Andy Armstrong
2017-07-19 10:17:49 -04:00
parent 7452456986
commit 95e47ddb02
29 changed files with 2150 additions and 42 deletions

View File

@@ -28,16 +28,27 @@ def show_reference_template(request, template):
e.g. /template/ux/reference/index.html?name=Foo
"""
try:
uses_bootstrap = u'/bootstrap/' in request.path
uses_pattern_library = u'/pattern-library/' in request.path
is_v1 = u'/v1/' in request.path
uses_bootstrap = not uses_pattern_library and not is_v1
context = {
"disable_courseware_js": not is_v1,
"uses_pattern_library": uses_pattern_library,
"uses_bootstrap": uses_bootstrap,
'request': request,
'disable_courseware_js': not is_v1,
'uses_pattern_library': uses_pattern_library,
'uses_bootstrap': uses_bootstrap,
}
context.update(request.GET.dict())
# Support dynamic rendering of messages
if request.GET.get('alert'):
register_info_message(request, request.GET.get('alert'))
if request.GET.get('success'):
register_success_message(request, request.GET.get('success'))
if request.GET.get('warning'):
register_warning_message(request, request.GET.get('warning'))
if request.GET.get('error'):
register_error_message(request, request.GET.get('error'))
# 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'))
@@ -47,4 +58,4 @@ def show_reference_template(request, template):
return render_to_response(template, context)
except TopLevelLookupException:
return HttpResponseNotFound("Couldn't find template {template}".format(template=template))
return HttpResponseNotFound('Missing template {template}'.format(template=template))