Skip to content

Commit

Permalink
added javascripts in portal_javascript registry
Browse files Browse the repository at this point in the history
  • Loading branch information
gborelli committed Apr 5, 2013
1 parent 7493dd1 commit 52a4727
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
11 changes: 7 additions & 4 deletions README.rst
Expand Up @@ -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

Expand Down Expand Up @@ -31,7 +38,6 @@ by having a buildout configuration such as: ::

Install this product from the Plone control panel.


Integration example
===================

Expand All @@ -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>
Expand Down
4 changes: 0 additions & 4 deletions collective/geo/openlayers/README.txt
Expand Up @@ -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)

Expand Down
20 changes: 20 additions & 0 deletions collective/geo/openlayers/profiles/default/jsregistry.xml
@@ -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>
2 changes: 0 additions & 2 deletions collective/geo/openlayers/tests/openlayers_test.pt
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions collective/geo/openlayers/tests/test_setup.py
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion docs/HISTORY.txt
Expand Up @@ -4,7 +4,7 @@ Changelog
2.6 (unreleased)
----------------

- Nothing changed yet.
- added javascripts in portal_javascript registry [gborelli]


2.5 (2013-01-28)
Expand Down

0 comments on commit 52a4727

Please sign in to comment.