allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jetm...@apache.org
Subject [1/3] allura git commit: [#7802] make it possible for a child theme to re-use all the resources from the parent
Date Wed, 10 Dec 2014 11:53:42 GMT
Repository: allura
Updated Branches:
  refs/heads/master 5407aa963 -> f2e4241ea


[#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/f2e4241e
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/f2e4241e
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/f2e4241e

Branch: refs/heads/master
Commit: f2e4241ea10884dab86b28c56d3f81cfe59011b4
Parents: ffd5a36
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Mon Dec 8 23:15:45 2014 +0000
Committer: Igor Bondarenko <jetmind2@gmail.com>
Committed: Wed Dec 10 13:51:35 2014 +0200

----------------------------------------------------------------------
 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/f2e4241e/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/f2e4241e/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):
         '''


Mime
View raw message