Skip to content

Commit

Permalink
Merge f054638 into 0366b67
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Aug 14, 2018
2 parents 0366b67 + f054638 commit a1f36e9
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 28 deletions.
5 changes: 5 additions & 0 deletions CHANGES.rst
Expand Up @@ -10,6 +10,11 @@ There's a frood who really knows where his towel is.
Upgrading from versions below 1.2b1 is no longer supported.
You must upgrade at least to version 1.2b1 before upgrading to this release.

- Remove cover predefined Layouts.
This avoid layout break between Plone 4 and Plone 5 because they use different layout systems.
The Layout functionality still works as always (closes `#652 <https://github.com/collective/collective.cover/issues/652>`_).
[rodfersou]

- Remove upgrade steps for old, unsupported releases.
[hvelarde]

Expand Down
5 changes: 0 additions & 5 deletions docs/developer.rst
Expand Up @@ -289,11 +289,6 @@ Layouts

``collective.cover`` supports saving layout designs by exporting them to a JSON/Python dictionary which are stored in the Plone registry.
You always start a new cover by selecting one of these layout designs on the Add Cover page.

.. NOTE::
``collective.cover`` inserts a few of these saved preset layouts upon installation.
Check ``registry.xml`` in the source of the package.

If you switch from the default 16-column Deco grid to another grid with a different number of columns,
these saved layouts will still contain a 16-column width and this can mock up your design in small ways.
In that case,
Expand Down
5 changes: 1 addition & 4 deletions src/collective/cover/profiles/default/registry.xml
Expand Up @@ -10,10 +10,7 @@
<value_type type="plone.registry.field.TextLine"/>
</field>
<value purge="false">
<element key="Layout A">[{"type": "row", "children": [{"id": "group1", "type": "group", "column-size": 16, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.carousel", "type": "tile", "id": "d34acf7c70084016810946f9039ffb67"}]}]}, {"type": "row", "children": [{"type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "7bb03c26b2504b8a9cadf5b852cc8a2c"}]}, {"type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.collection", "type": "tile", "id": "cc6d0ff688a143b38d64db2493ca74ce"}]}]}, {"type": "row", "children": [{"id": "group2", "type": "group", "column-size": 5, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "6673d5554e934b4396790a92698e32d0"}]}, {"type": "group", "column-size": 5, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "db093ff0b98c4475aeb4cb7c3a78e9ba"}]}, {"type": "group", "column-size": 5, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "bfe62e09db9e4a538f92dbeda8db42de"}]}]}]</element>
<element key="Layout B">[{"type": "row", "children": [{"id": "group1", "type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "4ebc5e6678044918b76280ec0204041a"}]}, {"type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "7d68fd4cf0e34073aea99568f1e8eef6"}]}]}, {"type": "row", "children": [{"id": "group2", "type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "03fbc0eccfb446debef114ebfa49a14c"}]}, {"type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "d9892b66d47547fb99cfa4ac9802b2c3"}]}]}]</element>
<element key="Layout C">[{"type": "row", "children": [{"id": "group1", "type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "33ab4627d26a4e868bb6044d5f270633"}]}, {"type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "ff53063434ea4be1968c19a94ae57a29"}]}]}, {"type": "row", "children": [{"id": "group2", "type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "c57800cb56dc44ccae531517af725c2e"}]}, {"type": "group", "column-size": 8, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "81af4c0eb99343e286a4a07c15c40c2c"}]}]}]</element>
<element key="Empty layout">[{"type": "row", "children": [{"type": "group", "column-size": 16, "roles": ["Manager"]}]}]</element>
<element key="Empty layout">[]</element>
</value>
</record>

Expand Down
17 changes: 17 additions & 0 deletions src/collective/cover/profiles/testfixture/registry.xml
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<registry>
<record field="layouts"
interface="collective.cover.controlpanel.ICoverSettings"
name="collective.cover.controlpanel.ICoverSettings.layouts">
<field type="plone.registry.field.Dict">
<key_type type="plone.registry.field.TextLine"/>
<value_type type="plone.registry.field.TextLine"/>
</field>
<value purge="false">
<element key="Layout A">[{"type": "row", "children": [{"id": "group1", "type": "group", "column-size": 12, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.carousel", "type": "tile", "id": "d34acf7c70084016810946f9039ffb67"}]}]}, {"type": "row", "children": [{"type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "7bb03c26b2504b8a9cadf5b852cc8a2c"}]}, {"type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.collection", "type": "tile", "id": "cc6d0ff688a143b38d64db2493ca74ce"}]}]}, {"type": "row", "children": [{"id": "group2", "type": "group", "column-size": 4, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "6673d5554e934b4396790a92698e32d0"}]}, {"type": "group", "column-size": 4, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "db093ff0b98c4475aeb4cb7c3a78e9ba"}]}, {"type": "group", "column-size": 4, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "bfe62e09db9e4a538f92dbeda8db42de"}]}]}]</element>
<element key="Layout B">[{"type": "row", "children": [{"id": "group1", "type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "4ebc5e6678044918b76280ec0204041a"}]}, {"type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "7d68fd4cf0e34073aea99568f1e8eef6"}]}]}, {"type": "row", "children": [{"id": "group2", "type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "03fbc0eccfb446debef114ebfa49a14c"}]}, {"type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "d9892b66d47547fb99cfa4ac9802b2c3"}]}]}]</element>
<element key="Layout C">[{"type": "row", "children": [{"id": "group1", "type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "33ab4627d26a4e868bb6044d5f270633"}]}, {"type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.basic", "type": "tile", "id": "ff53063434ea4be1968c19a94ae57a29"}]}]}, {"type": "row", "children": [{"id": "group2", "type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "c57800cb56dc44ccae531517af725c2e"}]}, {"type": "group", "column-size": 6, "roles": ["Manager"], "children": [{"tile-type": "collective.cover.list", "type": "tile", "id": "81af4c0eb99343e286a4a07c15c40c2c"}]}]}]</element>
<element key="Empty layout">[{"type": "row", "children": [{"type": "group", "column-size": 12, "roles": ["Manager"]}]}]</element>
</value>
</record>
</registry>
36 changes: 18 additions & 18 deletions src/collective/cover/tests/test_grid.py
Expand Up @@ -59,12 +59,12 @@ def test_deco16_grid(self):
cells1 = rows[1].cssselect('div.cell')
cells2 = rows[2].cssselect('div.cell')

self.assertTrue(_has_classes(cells0[0], ('width-16', 'position-0')))
self.assertTrue(_has_classes(cells1[0], ('width-8', 'position-0')))
self.assertTrue(_has_classes(cells1[1], ('width-8', 'position-8')))
self.assertTrue(_has_classes(cells2[0], ('width-5', 'position-0')))
self.assertTrue(_has_classes(cells2[1], ('width-5', 'position-5')))
self.assertTrue(_has_classes(cells2[2], ('width-5', 'position-10')))
self.assertTrue(_has_classes(cells0[0], ('width-12', 'position-0')))
self.assertTrue(_has_classes(cells1[0], ('width-6', 'position-0')))
self.assertTrue(_has_classes(cells1[1], ('width-6', 'position-6')))
self.assertTrue(_has_classes(cells2[0], ('width-4', 'position-0')))
self.assertTrue(_has_classes(cells2[1], ('width-4', 'position-4')))
self.assertTrue(_has_classes(cells2[2], ('width-4', 'position-8')))

def test_bootstrap3_grid(self):
self._switch_grid_system('bootstrap3')
Expand All @@ -75,12 +75,12 @@ def test_bootstrap3_grid(self):
cells1 = rows[1].cssselect('div.column')
cells2 = rows[2].cssselect('div.column')

self.assertTrue(_has_classes(cells0[0], ('col-md-16',)))
self.assertTrue(_has_classes(cells1[0], ('col-md-8',)))
self.assertTrue(_has_classes(cells1[1], ('col-md-8',)))
self.assertTrue(_has_classes(cells2[0], ('col-md-5',)))
self.assertTrue(_has_classes(cells2[1], ('col-md-5',)))
self.assertTrue(_has_classes(cells2[2], ('col-md-5',)))
self.assertTrue(_has_classes(cells0[0], ('col-md-12',)))
self.assertTrue(_has_classes(cells1[0], ('col-md-6',)))
self.assertTrue(_has_classes(cells1[1], ('col-md-6',)))
self.assertTrue(_has_classes(cells2[0], ('col-md-4',)))
self.assertTrue(_has_classes(cells2[1], ('col-md-4',)))
self.assertTrue(_has_classes(cells2[2], ('col-md-4',)))

def test_bootstrap2_grid(self):
self._switch_grid_system('bootstrap2')
Expand All @@ -91,9 +91,9 @@ def test_bootstrap2_grid(self):
cells1 = rows[1].cssselect('div.column')
cells2 = rows[2].cssselect('div.column')

self.assertTrue(_has_classes(cells0[0], ('span16',)))
self.assertTrue(_has_classes(cells1[0], ('span8',)))
self.assertTrue(_has_classes(cells1[1], ('span8',)))
self.assertTrue(_has_classes(cells2[0], ('span5',)))
self.assertTrue(_has_classes(cells2[1], ('span5',)))
self.assertTrue(_has_classes(cells2[2], ('span5',)))
self.assertTrue(_has_classes(cells0[0], ('span12',)))
self.assertTrue(_has_classes(cells1[0], ('span6',)))
self.assertTrue(_has_classes(cells1[1], ('span6',)))
self.assertTrue(_has_classes(cells2[0], ('span4',)))
self.assertTrue(_has_classes(cells2[1], ('span4',)))
self.assertTrue(_has_classes(cells2[2], ('span4',)))
2 changes: 1 addition & 1 deletion src/collective/cover/tests/test_widget_preview.py
Expand Up @@ -38,6 +38,6 @@ def test_layout_structure(self):

widget.simplify_layout(json.loads(layouts['Layout A']), sl)

simplified_layout = [{'type': 'row', 'children': [{'type': 'group', 'children': [{'tile-type': u'collective.cover.carousel', 'type': 'tile'}], 'size': 16}]}, {'type': 'row', 'children': [{'type': 'group', 'children': [{'tile-type': u'collective.cover.list', 'type': 'tile'}], 'size': 8}, {'type': 'group', 'children': [{'tile-type': u'collective.cover.collection', 'type': 'tile'}], 'size': 8}]}, {'type': 'row', 'children': [{'type': 'group', 'children': [{'tile-type': u'collective.cover.basic', 'type': 'tile'}], 'size': 5}, {'type': 'group', 'children': [{'tile-type': u'collective.cover.basic', 'type': 'tile'}], 'size': 5}, {'type': 'group', 'children': [{'tile-type': u'collective.cover.basic', 'type': 'tile'}], 'size': 5}]}]
simplified_layout = [{'type': 'row', 'children': [{'type': 'group', 'children': [{'tile-type': u'collective.cover.carousel', 'type': 'tile'}], 'size': 12}]}, {'type': 'row', 'children': [{'type': 'group', 'children': [{'tile-type': u'collective.cover.list', 'type': 'tile'}], 'size': 6}, {'type': 'group', 'children': [{'tile-type': u'collective.cover.collection', 'type': 'tile'}], 'size': 6}]}, {'type': 'row', 'children': [{'type': 'group', 'children': [{'tile-type': u'collective.cover.basic', 'type': 'tile'}], 'size': 4}, {'type': 'group', 'children': [{'tile-type': u'collective.cover.basic', 'type': 'tile'}], 'size': 4}, {'type': 'group', 'children': [{'tile-type': u'collective.cover.basic', 'type': 'tile'}], 'size': 4}]}]

self.assertEqual(sl, simplified_layout)

0 comments on commit a1f36e9

Please sign in to comment.