diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst index a78b34d0f..029115821 100644 --- a/docs/CHANGES.rst +++ b/docs/CHANGES.rst @@ -4,6 +4,9 @@ There's a frood who really knows where his towel is 1.0a5 (unreleased) ^^^^^^^^^^^^^^^^^^ +- Auto add a column when adding a row (closes `#212`_). + [marcosfromero] + - Remove dependency on plone.batching to avoid ``IndexError: multiple_pages`` on Plone 4.2. [jpgimenez] @@ -222,6 +225,7 @@ There's a frood who really knows where his towel is .. _`#198`: https://github.com/collective/collective.cover/issues/198 .. _`#203`: https://github.com/collective/collective.cover/issues/203 .. _`#206`: https://github.com/collective/collective.cover/issues/206 +.. _`#212`: https://github.com/collective/collective.cover/issues/212 .. _`#218`: https://github.com/collective/collective.cover/issues/218 .. _`#239`: https://github.com/collective/collective.cover/issues/239 .. _`#249`: https://github.com/collective/collective.cover/issues/249 diff --git a/docs/CREDITS.rst b/docs/CREDITS.rst index 0d066c8eb..f53be4e5b 100644 --- a/docs/CREDITS.rst +++ b/docs/CREDITS.rst @@ -16,6 +16,7 @@ the following people: - Héctor Velarde - Juan A. Díaz - Juan Pablo Giménez +- Marcos F. Romero - Ricardo Bánffy - Rodrigo Ferreira de Souza - Silvestre Huens diff --git a/src/collective/cover/layout.py b/src/collective/cover/layout.py index c98d7bcc0..cd338cec7 100644 --- a/src/collective/cover/layout.py +++ b/src/collective/cover/layout.py @@ -158,10 +158,12 @@ def update(self): def get_tile_metadata(self, tile_name): tile_type = getUtility(ITileType, tile_name) + tile = self.context.restrictedTraverse(str(tile_name)) tile_metadata = { 'icon': tile_type.icon, 'description': tile_type.description, - 'title': tile_type.title + 'title': tile_type.title, + 'is_configurable': tile.is_configurable and 1 or 0 } return tile_metadata diff --git a/src/collective/cover/layout_templates/tilelist.pt b/src/collective/cover/layout_templates/tilelist.pt index a062b6d44..a3b86ecef 100644 --- a/src/collective/cover/layout_templates/tilelist.pt +++ b/src/collective/cover/layout_templates/tilelist.pt @@ -14,6 +14,7 @@ ").addClass("tile-name") .text(ui.draggable.data('tile-name')); - new_tile.append(config_link) - .append(name_tag); + if(is_configurable) { + new_tile.append(config_link) + } + new_tile.append(name_tag); $(column_elem).append(new_tile); self.delete_manager(new_tile); diff --git a/src/collective/cover/tests/test_layout.txt b/src/collective/cover/tests/test_layout.txt index 339b90523..92afcb1b1 100644 --- a/src/collective/cover/tests/test_layout.txt +++ b/src/collective/cover/tests/test_layout.txt @@ -30,14 +30,15 @@ Test Basic Layout Operations Count Number of Rows 1 #add a row after the existing one. + #it comes with a new column Add Row #add a column in the latest row Add Column at First Row Add Column at Second Row Add Column at Second Row - #2 columns and 2 rows - Count Number of Columns 4 + #5 columns and 2 rows + Count Number of Columns 5 Count Number of Rows 2 Save Cover Layout @@ -45,14 +46,14 @@ Test Basic Layout Operations # load layout again, it has to be the new one Click Link link=Layout - #2 columns and 2 rows - Count Number of Columns 4 + #3 columns and 2 rows + Count Number of Columns 5 Count Number of Rows 2 Delete a Column in the First Row Delete the First Row - Count Number of Columns 2 + Count Number of Columns 3 Count Number of Rows 1 Save Cover Layout