Merge pull request #10623 from eduNEXT/fmo/wiki-support-for-microsites

WIP wiki support for microsite templates
This commit is contained in:
Matt Drayer
2016-01-12 14:27:27 -05:00
4 changed files with 36 additions and 4 deletions

View File

@@ -63,3 +63,14 @@ def microsite_css_overrides_file():
return "<link href='{}' rel='stylesheet' type='text/css'>".format(static(file_path))
else:
return ""
@register.filter
def microsite_template_path(template_name):
"""
Django template filter to apply template overriding to microsites.
The django_templates loader does not support the leading slash, therefore
it is stripped before returning.
"""
template_name = microsite.get_template_path(template_name)
return template_name[1:] if template_name[0] == '/' else template_name

View File

@@ -32,3 +32,10 @@ class MicroSiteTests(TestCase):
expected = u'my | less specific | Page | edX'
title = microsite.page_title_breadcrumbs_tag(None, *crumbs)
self.assertEqual(expected, title)
def test_microsite_template_path(self):
"""
When an unexistent path is passed to the filter, it should return the same path
"""
path = microsite.microsite_template_path('footer.html')
self.assertEqual("footer.html", path)