Skip to content

Commit

Permalink
Merge pull request #44 from plone/portlet-manager
Browse files Browse the repository at this point in the history
render the footer portlets in a way where they can still  be edited with @@manage-portlets
  • Loading branch information
vangheem committed May 14, 2015
2 parents 40a6b4b + ab5675b commit 3382b85
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
5 changes: 3 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Changelog
2.5.7 (unreleased)
------------------

- Nothing changed yet.

- render the footer portlets in a way where they can still
be edited with @@manage-portlets
[vangheem]

2.5.6 (2015-05-13)
------------------
Expand Down
25 changes: 25 additions & 0 deletions plone/app/layout/viewlets/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,3 +459,28 @@ class FooterViewlet(ViewletBase):
def update(self):
super(FooterViewlet, self).update()
self.year = date.today().year

def render_footer_portlets(self):
"""
You might ask, why is this necessary. Well, let me tell you a story...
plone.app.portlets, in order to provide @@manage-portlets on a context,
overrides the IPortletRenderer for the IManageContextualPortletsView view.
See plone.portlets and plone.app.portlets
Seems fine right? Well, most of the time it is. Except, here. Previously,
we were just using the syntax like `provider:plone.footerportlets` to
render the footer portlets. Since this tal expression was inside
a viewlet, the view is no longer IManageContextualPortletsView when
visiting @@manage-portlets. Instead, it was IViewlet.
See zope.contentprovider
In to fix this short coming, we render the portlet column by
manually doing the multi adapter lookup and then manually
doing the rendering for the content provider.
See zope.contentprovider
"""
portlet_manager = getMultiAdapter(
(self.context, self.request, self.__parent__), name='plone.footerportlets')
portlet_manager.update()
return portlet_manager.render()
2 changes: 1 addition & 1 deletion plone/app/layout/viewlets/footer.pt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="row">
<div class="col-xs-12">
<div tal:on-error="nothing" tal:replace="structure provider:plone.footerportlets" />
<div tal:on-error="nothing" tal:replace="structure view/render_footer_portlets" />
</div>
</div>

0 comments on commit 3382b85

Please sign in to comment.