From f2c40a71fe3b1d775241efa7109dd897fb834521 Mon Sep 17 00:00:00 2001 From: Nate Hardison Date: Fri, 31 May 2013 15:17:45 -0700 Subject: [PATCH] Enable theming in base LMS template Provide the appropriate switches to adjust based on whether or not a theme (in particular, the Stanford theme) is enabled in the settings. For now, these changes are very specific to Stanford. This is because the template architecture needs some reworking to generalize nicely. --- lms/templates/main.html | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/lms/templates/main.html b/lms/templates/main.html index 313025d09a..d6cbe21095 100644 --- a/lms/templates/main.html +++ b/lms/templates/main.html @@ -1,9 +1,28 @@ <%namespace name='static' file='static_content.html'/> <%! from django.utils import html %> + +## Define a couple of helper functions to make life easier when +## embedding theme conditionals into templates. All inheriting +## templates have access to these functions, and we can import these +## into non-inheriting templates via the %namespace tag. +<%def name="theme_enabled()"> + <% return settings.MITX_FEATURES["USE_CUSTOM_THEME"] %> + + +<%def name="stanford_theme_enabled()"> + <% return theme_enabled() and getattr(settings, "THEME_NAME") == "stanford" %> + + - <%block name="title">edX + <%block name="title"> + % if stanford_theme_enabled(): + Home | class.stanford.edu + % else: + edX + % endif +