From f2c40a71fe3b1d775241efa7109dd897fb834521 Mon Sep 17 00:00:00 2001 From: Nate Hardison Date: Fri, 31 May 2013 15:17:45 -0700 Subject: [PATCH 01/30] 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 313025d09a24..d6cbe210958f 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 + - + <%static:css group='application'/> From f055c6f9893439bdae6148eb313124ef32dc6ae5 Mon Sep 17 00:00:00 2001 From: Nate Hardison Date: Fri, 31 May 2013 15:37:00 -0700 Subject: [PATCH 03/30] Inject theming hooks into navigation bar Allow themes to inherit from the default navigation bar and override pieces of it, including the main logo, the links that display to the right of the logo, and the links inside the dropdown menu (with the exception of the `Log Out` link. In addition, this adds an empty block at the very top so that themes can place a branding bar at the top of the page. (Stanford identity guidelines require this: see https://identity.stanford.edu.) --- lms/templates/navigation.html | 51 ++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index 13c461173b55..104366c8c43a 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -1,6 +1,6 @@ ## mako <%namespace name='static' file='static_content.html'/> -<%namespace file='main.html' import="login_query"/> +<%namespace file='main.html' import="login_query, stanford_theme_enabled"/> <%! from django.core.urlresolvers import reverse @@ -10,6 +10,9 @@ from status.status import get_site_status_msg %> +## Provide a hook for themes to inject branding on top. +<%block name="navigation_top" /> + <%block cached="False"> <% try: @@ -38,9 +41,12 @@