Permalink
Browse files

added javascripts in portal_javascript registry

  • Loading branch information...
1 parent 7493dd1 commit 52a47274fe6cf87a927d54f9c5757aeaf9337b6d @gborelli gborelli committed Apr 5, 2013
View
@@ -3,6 +3,13 @@ Introduction
collective.geo.openlayers enables `Openlayers`_ machinery into Plone.
+This package registers two javascript files into Plone javascript registry:
+
+1. OpenLayers.js
+2. proj4js-compressed.js
+
+
+
.. image:: https://secure.travis-ci.org/collective/collective.geo.openlayers.png
:target: http://travis-ci.org/collective/collective.geo.openlayers
@@ -31,7 +38,6 @@ by having a buildout configuration such as: ::
Install this product from the Plone control panel.
-
Integration example
===================
@@ -50,9 +56,6 @@ other `openlayers examples`_)::
portal_state context/@@plone_portal_state;
portal_url portal_state/portal_url" />
<metal:block metal:fill-slot="javascript_head_slot">
- <script type="text/javascript"
- tal:attributes="src string:$portal_url/OpenLayers.js"></script>
-
<!-- optional openlayers translation -->
<script type="text/javascript"
tal:attributes="src string:$portal_url/lang/de.js"></script>
@@ -15,10 +15,6 @@ the @@openlayers view must contain a div wrapper for a map
>>> '<div id="map" ' in browser.contents
True
-openlayers javascript
- >>> '<script type="text/javascript" src="http://nohost/plone/OpenLayers.js"></script>' in browser.contents
- True
-
Now, check to make sure the CSS files from OpenLayers are accessible. This causes issues if for the client if they can't be found (eg when the directories aren't registered)
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<object name="portal_javascripts">
+ <javascript
+ cacheable="True"
+ compression="safe"
+ cookable="True"
+ enabled="True"
+ expression=""
+ id="OpenLayers.js"
+ inline="False" />
+ <javascript
+ cacheable="True"
+ compression="safe"
+ cookable="True"
+ enabled="True"
+ expression=""
+ id="proj4js-compressed.js"
+ inline="False" />
+
+</object>
@@ -17,8 +17,6 @@
</metal:block>
<metal:block metal:fill-slot="javascript_head_slot">
- <script type="text/javascript"
- tal:attributes="src string:$portal_url/OpenLayers.js"></script>
<script type="text/javascript">
<!--
var map;
@@ -63,6 +63,18 @@ def test_resource_openlayerscss(self):
self.get_resource('++resource++geo-openlayers.css')
)
+ def test_javascript_resources(self):
+ pjs = getToolByName(self.portal, 'portal_javascripts')
+ resources = [
+ ("OpenLayers.js", True),
+ ("proj4js-compressed.js", True)
+ ]
+
+ for id_, enabled in resources:
+ res = pjs.getResource(id_)
+ self.assertIsNotNone(res)
+ self.assertEqual(enabled, res.getEnabled())
+
def test_suite():
suite = unittest.TestSuite()
View
@@ -4,7 +4,7 @@ Changelog
2.6 (unreleased)
----------------
-- Nothing changed yet.
+- added javascripts in portal_javascript registry [gborelli]
2.5 (2013-01-28)

0 comments on commit 52a4727

Please sign in to comment.