Permalink
Browse files

Set header for dynamic_tooltips.js (Enables caching/merging).

  • Loading branch information...
1 parent bd65945 commit 4c37d31fa483278d480e071c8b4b1f27d1bf4575 @maethu maethu committed Mar 4, 2014
View
@@ -4,7 +4,8 @@ Changelog
1.1.4 (unreleased)
------------------
-- Nothing changed yet.
+- Do not render dynamic_tooltips.js inline.
+ [mathias.leimgruber]
1.1.3 (2014-02-10)
@@ -13,6 +13,8 @@ class TooltipJs(BrowserView):
def __call__(self):
"""Returns the js code directly"""
+ self.request.response.setHeader('Content-Type',
+ 'application/javascript')
return self.template()
def get_all_tips(self):
@@ -1,4 +1,3 @@
-<div tal:replace="structure python: '//<![CDATA['" />
<tal:def define="ftwtooltips view/generate_tooltip_js_source">
var ftwtooltips = <span tal:replace="ftwtooltips" />;
@@ -52,4 +51,3 @@ $(function(){
});
});
</tal:def>
-<div tal:replace="structure python: '//]]>'" />
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<object name="portal_javascripts" meta_type="JavaScripts Registry">
<javascript cacheable="False" compression="safe" cookable="False" expression=""
- enabled="True" id="@@dynamic_tooltips.js" inline="True"
- />
+ enabled="True" id="@@dynamic_tooltips.js" inline="False"
+ insert-after="*" />
<javascript enabled="True" id="++resource++plone.app.jquerytools.plugins.js" />
</object>
@@ -1,4 +1,4 @@
<?xml version="1.0"?>
<metadata>
- <version>1131</version>
+ <version>1132</version>
</metadata>
@@ -11,6 +11,7 @@
from zope.browser.interfaces import IBrowserView
from zope.interface import Interface, implements
from zope.component import adapts
+from mocker import ANY
class TestTooltip(MockTestCase):
@@ -24,6 +25,8 @@ def setUp(self):
setattr(self.request, 'response', self.response)
self.expect(self.response.getHeader('Content-Type')).result(
'text/javascript')
+ self.response.setHeader('Content-Type', 'application/javascript')
+
directlyProvides(self.request, IDefaultBrowserLayer)
self.replay()
@@ -15,4 +15,13 @@
directory="profiles/1131"
/>
+ <!-- 1131 -> 1132-->
+ <upgrade-step:importProfile
+ title="Do not render dynamic_tooltips.js inline"
+ profile="ftw.tooltip:default"
+ source="1131"
+ destination="1132"
+ directory="profiles/1132"
+ />
+
</configure>
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<object name="portal_javascripts" meta_type="JavaScripts Registry">
+ <javascript cacheable="False" compression="safe" cookable="False" expression=""
+ enabled="True" id="@@dynamic_tooltips.js" inline="False"
+ insert-after="*"/>
+</object>

0 comments on commit 4c37d31

Please sign in to comment.