Skip to content

Commit

Permalink
Upgrade to plone.app.blocks 2.x [#331]
Browse files Browse the repository at this point in the history
  • Loading branch information
datakurre committed Apr 24, 2015
1 parent 6c4bcaa commit 408a82d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions src/collective/cover/browser/cover.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
from AccessControl import getSecurityManager
from Acquisition import aq_inner
from plone.app.blocks.interfaces import IBlocksTransformEnabled
from collective.cover.controlpanel import ICoverSettings
from collective.cover.interfaces import ICover
from collective.cover.interfaces import IGridSystem
Expand All @@ -24,12 +25,14 @@

class View(grok.View):
grok.context(ICover)
grok.implements(IBlocksTransformEnabled)
grok.require('zope2.View')
grok.name('view')


class Standard(grok.View):
grok.context(ICover)
grok.implements(IBlocksTransformEnabled)
grok.require('zope2.View')
grok.name('standard')

Expand Down Expand Up @@ -135,6 +138,7 @@ def __call__(self):
# XXX: we need to leave the view after saving or cancelling editing
class Compose(grok.View):
grok.context(ICover)
grok.implements(IBlocksTransformEnabled)
grok.require('cmf.ModifyPortalContent')

def update(self):
Expand Down
14 changes: 10 additions & 4 deletions src/collective/cover/layout_templates/tile.pt
Expand Up @@ -33,20 +33,26 @@
</div>

<div tal:attributes="class python:'%s' % section.get('class', '');
data-tile python:'%s' %(tile_url);
id tile_id" />
id tile_id">
<div tal:attributes="data-tile python:'%s' %(tile_url);">
Tile content replaced during the blocks transform.
</div>
</div>
</tal:co>
</tal:view>

<tal:compose tal:condition="python:mode == 'compose'">
<div tal:condition="section" class="tile-container">
<span class="tile-type-name" tal:content="tile_title" />
<div tal:attributes="class python:'%s %s' % (section.get('class', ''), view.can_compose_tile_class(tile_type, tile_id));
data-tile python:'%s' %(tile_url);
data-tile-type tile_type;
data-tile-valid-ct python:view.accepted_ct_for_tile(tile_type);
data-is-droppable python:view.tile_is_droppable(tile_type);
id tile_id" />
id tile_id">
<div tal:attributes="data-tile python:'%s' %(tile_url);">
Tile content replaced during the blocks transform.
</div>
</div>
<a href="#" class="edit-tile-link"
tal:condition="python:view.tile_is_editable(tile_type)"
tal:attributes="href string:${context/absolute_url}/@@edit-tile/${tile_type}/${tile_id}"
Expand Down
2 changes: 1 addition & 1 deletion versions-4.3.x.cfg
@@ -1,6 +1,6 @@
[versions]
collective.js.bootstrap = 2.3.1.1
plone.app.blocks = 1.1.1
plone.app.blocks = 2.0.0
plone.app.drafts = 1.0a2
plone.app.tiles = 1.0.1
plone.tiles = 1.2
Expand Down

1 comment on commit 408a82d

@datakurre
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@petri @hvelarde Two major changes in p.a.blocks 2.x:

  • the transform is opt-in (see above for the required changes for each view)
  • tile transform really replaces the tile tag, which was the original (and documented - also in c.cover) behavior before the Sea Sprint changed it and c.cover was silently adapted to it

Please sign in to comment.