From 8e1d0f7f23794783a85fe6938839942b510221a3 Mon Sep 17 00:00:00 2001 From: Chris Dodge <cdodge@edx.org> Date: Wed, 17 Sep 2014 10:52:04 -0400 Subject: [PATCH] For microsites, since we don't have a footer override yet for django templates, remove the footer all together --- common/djangoapps/edxmako/shortcuts.py | 10 ++++++++++ lms/envs/common.py | 3 +++ lms/templates/main_django.html | 4 +++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/common/djangoapps/edxmako/shortcuts.py b/common/djangoapps/edxmako/shortcuts.py index 67bc36e..ff86cf8 100644 --- a/common/djangoapps/edxmako/shortcuts.py +++ b/common/djangoapps/edxmako/shortcuts.py @@ -103,6 +103,16 @@ def open_source_footer_context_processor(request): ) +def microsite_footer_context_processor(request): + """ + Checks the site name to determine whether to use the edX.org footer or the Open Source Footer. + """ + return dict( + [ + ("IS_REQUEST_IN_MICROSITE", microsite.is_request_in_microsite()) + ] + ) + def render_to_string(template_name, dictionary, context=None, namespace='main'): # see if there is an override template defined in the microsite diff --git a/lms/envs/common.py b/lms/envs/common.py index 46feaa1..0cac7ae 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -380,6 +380,9 @@ TEMPLATE_CONTEXT_PROCESSORS = ( # Shoppingcart processor (detects if request.user has a cart) 'shoppingcart.context_processor.user_has_cart_context_processor', + + # Allows the open edX footer to be leveraged in Django Templates. + 'edxmako.shortcuts.microsite_footer_context_processor', ) # use the ratelimit backend to prevent brute force attacks diff --git a/lms/templates/main_django.html b/lms/templates/main_django.html index 9de60bf..bc47156 100644 --- a/lms/templates/main_django.html +++ b/lms/templates/main_django.html @@ -40,7 +40,9 @@ {% block body %}{% endblock %} {% block bodyextra %}{% endblock %} </div> - {% if IS_EDX_DOMAIN %} + {% if IS_REQUEST_IN_MICROSITE %} + {# For now we don't support overriden Django templates in microsites. Leave footer blank for now which is better than saying Edx.#} + {% elif IS_EDX_DOMAIN %} {% if ENABLE_NEW_EDX_FOOTER %} {% include "footer-edx-new.html" %} {% else %} -- libgit2 0.26.0