Skip to content

Commit

Permalink
register globalstatus message viewlet
Browse files Browse the repository at this point in the history
Conflicts:
	plone/app/layout/viewlets/configure.zcml
  • Loading branch information
toutpt committed Nov 14, 2013
1 parent 786842c commit fdd8c6f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 2 deletions.
11 changes: 9 additions & 2 deletions plone/app/layout/viewlets/configure.zcml
Expand Up @@ -36,8 +36,8 @@
/>

<browser:viewletManager
name="plone.globalstatusmessage"
provides=".interfaces.IGlobalStatusMessage"
name="plone.globalstatusmessages"
provides=".interfaces.IGlobalStatusMessages"
permission="zope2.View"
class="plone.app.viewletmanager.manager.OrderedViewletManager"
/>
Expand Down Expand Up @@ -318,6 +318,13 @@
permission="zope2.View"
/>

<browser:viewlet
name="plone.globalstatusmessage"
manager=".interfaces.IGlobalStatusMessages"
class=".globalstatusmessage.GlobalStatusMessage"
permission="zope2.View"
/>

<!-- Render the document byline -->
<browser:viewlet
name="plone.belowcontenttitle.documentbyline"
Expand Down
12 changes: 12 additions & 0 deletions plone/app/layout/viewlets/globalstatusmessage.pt
@@ -0,0 +1,12 @@
<tal:statusmsg tal:define="messages view/messages"
tal:repeat="message messages">

<dl tal:define="mtype message/type | nothing;"
tal:attributes="class string:portalMessage ${mtype};">
<dt i18n:translate="" tal:content="python:mtype.captialize()">Info</dt>
<dd tal:content="message/message | nothing" i18n:translate="">
The status message.
</dd>
</dl>

</tal:statusmsg>
13 changes: 13 additions & 0 deletions plone/app/layout/viewlets/globalstatusmessage.py
@@ -0,0 +1,13 @@
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from plone.app.layout.viewlets.common import ViewletBase
from Products.statusmessages.interfaces import IStatusMessage


class GlobalStatusMessage(ViewletBase):
"""Display messages to the current user"""

index = ViewPageTemplateFile('globalstatusmessage.pt')

def update(self):
self.status = IStatusMessage(self.request)
self.messages = self.status.show()
5 changes: 5 additions & 0 deletions plone/app/layout/viewlets/interfaces.py
Expand Up @@ -47,6 +47,11 @@ class IAboveContent(IViewletManager):
"""


class IGlobalStatusMessages(IViewletManager):
"""A viewlet manager that sits above the content area
"""


class IAboveContentTitle(IViewletManager):
"""A viewlet manager that sits above the content title in view templates
"""
Expand Down

0 comments on commit fdd8c6f

Please sign in to comment.