Reputation: 1406
I have an alternate homepage template, homepage.pt, which has a different layout. When I click the manage-portlets link to edit the portlets, though, it uses main_template.pt instead of homepage.pt. Is there any way to have @@manage-portlets use whichever template the page you're editing the portlets for uses? It's workable as is, but the layout is quite different to what the page actually looks like.
Upvotes: 1
Views: 256
Reputation: 1406
So, the answer is yes, with a little messing around. You can use an alternate template for manage-contextual.pt out of plone.app.portlets and change the metal:use-macro attribute to use your custom macro. I used jbot and naming the file:
plone.app.portlets.browser.templates.manage-contextual.pt
does what it should. This replaces the manage portlets view for all pages though, including ones that were using main_template.pt. Not insurmountable, but a little annoying. I can think of a few solutions:
Upvotes: 0
Reputation: 156
We register another page for this purpose and register an portal_actions object action
zcml:
<browser:page
for="plone.portlets.interfaces.ILocalPortletAssignable"
class="plone.app.portlets.browser.manage.ManageContextualPortlets"
name="manage-homepageportlets"
template="templates/managehomepageportlets.pt"
permission="plone.app.portlets.ManagePortlets" />
view:
class HomepageView(BrowserView):
template = ViewPageTemplateFile('templates/homepage_view.pt')
action:
<object name="homepage portlets" meta_type="CMF Action">
<property name="title">Homepage-portlets</property>
<property name="url_expr">string:${portal_url}/@@manage-homepageportlets</property>
<property name="available_expr">python: here.absolute_url() == portal_url</property>
<property name="visible">True</property>
</object>
template:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
metal:use-macro="context/main_template/macros/master"
i18n:domain="plone">
<body>
<div metal:fill-slot="main">
<h1 class="documentFirstHeading">Manage Homepage Portlets</h1>
<h2>Top portlets</h2>
<span tal:replace="structure provider:project.homepagetop" />
<h2>Middle portlets</h2>
<span tal:replace="structure provider:project.homepagemiddle" />
<h2>Bottom portlets</h2>
<span tal:replace="structure provider:project.homepagebottom" />
</div>
</body>
</html>
Upvotes: 3