[ckan-changes] commit/ckan: zephod: [css][m]: Added template_head_end to config.

Bitbucket commits-noreply at bitbucket.org
Tue Oct 25 19:14:42 UTC 2011


1 new commit in ckan:


https://bitbucket.org/okfn/ckan/changeset/4c88433797b6/
changeset:   4c88433797b6
branch:      feature-1380-fix-css
user:        zephod
date:        2011-10-25 21:14:32
summary:     [css][m]: Added template_head_end to config.
affected #:  5 files

diff -r 62619790aebde9c2c698a9c2879eacb38f17887f -r 4c88433797b6e1997fd91d9833e60f0aeb937c6e ckan/config/deployment.ini_tmpl
--- a/ckan/config/deployment.ini_tmpl
+++ b/ckan/config/deployment.ini_tmpl
@@ -152,6 +152,11 @@
 ## Enable if the API is at a different domain
 # ckan.api_url = http://www.ckan.net
 
+## html content to be inserted just before </head> tag (e.g. extra stylesheet)
+## NB: can use html e.g. <strong>blah</strong>
+## NB: can have multiline strings just indent following lines
+# ckan.template_head_end = <link rel="stylesheet" href="http://mysite.org/css/custom.css" type="text/css"> 
+
 ## html content to be inserted just before </body> tag (e.g. google analytics code)
 ## NB: can use html e.g. <strong>blah</strong>
 ## NB: can have multiline strings just indent following lines


diff -r 62619790aebde9c2c698a9c2879eacb38f17887f -r 4c88433797b6e1997fd91d9833e60f0aeb937c6e ckan/lib/app_globals.py
--- a/ckan/lib/app_globals.py
+++ b/ckan/lib/app_globals.py
@@ -29,6 +29,7 @@
         # has been setup in load_environment():
         self.site_id = config.get('ckan.site_id')
 
+        self.template_head_end = config.get('ckan.template_head_end', '')
         self.template_footer_end = config.get('ckan.template_footer_end', '')
 
         # hide these extras fields on package read


diff -r 62619790aebde9c2c698a9c2879eacb38f17887f -r 4c88433797b6e1997fd91d9833e60f0aeb937c6e ckan/templates/layout_base.html
--- a/ckan/templates/layout_base.html
+++ b/ckan/templates/layout_base.html
@@ -42,6 +42,7 @@
     ${optional_head()}
   </py:if>
 
+  ${h.literal(getattr(g, 'template_head_end', ''))}
 </head><body class="${request.environ.get('pylons.routes_dict', {}).get('action')} 


diff -r 62619790aebde9c2c698a9c2879eacb38f17887f -r 4c88433797b6e1997fd91d9833e60f0aeb937c6e ckan/tests/functional/test_home.py
--- a/ckan/tests/functional/test_home.py
+++ b/ckan/tests/functional/test_home.py
@@ -58,6 +58,11 @@
         url = url_for('guide')
         assert url == 'http://wiki.okfn.org/ckan/doc/'
 
+    def test_template_head_end(self):
+        offset = url_for('home')
+        res = self.app.get(offset)
+        assert 'ckan.template_head_end = <link rel="stylesheet" href="TEST_TEMPLATE_HEAD_END.css" type="text/css"> '
+
     def test_template_footer_end(self):
         offset = url_for('home')
         res = self.app.get(offset)


diff -r 62619790aebde9c2c698a9c2879eacb38f17887f -r 4c88433797b6e1997fd91d9833e60f0aeb937c6e test-core.ini
--- a/test-core.ini
+++ b/test-core.ini
@@ -47,6 +47,9 @@
 # ckan.plugins = amqp_notifier
 
 # use <strong> so we can check that html is *not* escaped
+ckan.template_head_end = <link rel="stylesheet" href="TEST_TEMPLATE_HEAD_END.css" type="text/css"> 
+
+# use <strong> so we can check that html is *not* escaped
 ckan.template_footer_end = <strong>TEST TEMPLATE_FOOTER_END TEST</strong>
 
 # mailer

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list