You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2014/12/09 00:16:05 UTC
[2/2] allura git commit: [#7802] make it possible for a child theme
to re-use all the resources from the parent
[#7802] make it possible for a child theme to re-use all the resources from the parent
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/45557906
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/45557906
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/45557906
Branch: refs/heads/db/7802
Commit: 455579063e322c8b739cc53f72d50ceb03e25533
Parents: 60e0b7a
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Mon Dec 8 23:15:45 2014 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Dec 8 23:15:45 2014 +0000
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 4 +---
Allura/allura/lib/plugin.py | 13 +++++++++++++
2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/45557906/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index 8435f0f..d196cc8 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -539,9 +539,7 @@ class Globals(object):
self.resource_manager.register(ew.JSScript(text, **kw))
def theme_href(self, href):
- theme_name = config.get('theme', 'allura')
- return self.resource_manager.absurl(
- 'theme/%s/%s' % (theme_name, href))
+ return self.theme.href(href)
def forge_static(self, resource):
base = config['static.url_base']
http://git-wip-us.apache.org/repos/asf/allura/blob/45557906/Allura/allura/lib/plugin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
index 006a8e0..e761ef3 100644
--- a/Allura/allura/lib/plugin.py
+++ b/Allura/allura/lib/plugin.py
@@ -963,6 +963,8 @@ class ThemeProvider(object):
own jinja templates. Use the standard templates as a reference, you should
provide matching macros and block names.
+ For more information, see https://forge-allura.apache.org/p/allura/wiki/Themes%20in%20Allura/
+
:var icons: a dictionary of sized icons for each tool
'''
@@ -991,6 +993,17 @@ class ThemeProvider(object):
'allura',
os.path.join('nf', name)))
+ def href(self, href, theme_name=None):
+ '''
+ Build a full URL for a given resource path
+ :param href: a path like ``css/site_style.css``
+ :param theme_name: defaults to current theme
+ :return: a full URL
+ '''
+ if theme_name is None:
+ theme_name = config.get('theme', 'allura')
+ return g.resource_manager.absurl('theme/%s/%s' % (theme_name, href))
+
@LazyProperty
def personal_data_form(self):
'''