-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Adam Forsythe-Cheasley
committed
Jun 25, 2014
1 parent
0bbb797
commit 110873c
Showing
4 changed files
with
114 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile | ||
from plone.app.portlets.portlets import base | ||
from plone.portlets.interfaces import IPortletDataProvider | ||
from zope.formlib.form import Fields | ||
from zope.interface import implements | ||
|
||
|
||
class IRosterPortlet(IPortletDataProvider): | ||
""" | ||
Provides a button to participants which links to the roster view | ||
""" | ||
|
||
|
||
class Assignment(base.Assignment): | ||
|
||
implements(IRosterPortlet) | ||
|
||
@property | ||
def title(self): | ||
return u"Roster" | ||
|
||
|
||
class Renderer(base.Renderer): | ||
|
||
render = ViewPageTemplateFile("templates/roster_portlet.pt") | ||
|
||
@property | ||
def available(self): | ||
return True | ||
|
||
def on_workspace(self): | ||
""" | ||
are we within a workspace? | ||
""" | ||
return getattr(self.context, 'acquire_workspace', None) is not None | ||
|
||
|
||
class AddForm(base.AddForm): | ||
|
||
form_fields = Fields(IRosterPortlet) | ||
label = u"Add roster portlet" | ||
description = "This portlet gives participants access to the roster view" | ||
|
||
def create(self, data): | ||
return Assignment() | ||
|
||
|
||
class EditForm(base.EditForm): | ||
|
||
form_fields = Fields(IRosterPortlet) | ||
label = "Edit roster portlet" | ||
description = "This portlet gives participants access to the roster view" |
12 changes: 12 additions & 0 deletions
12
src/ploneintranet/workspace/browser/templates/roster_portlet.pt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<dl class="portlet portletAnnualSubscription"> | ||
<dt class="portletHeader"> | ||
<a href="" | ||
tal:attributes="href string:${context/absolute_url}/@@edit-roster" | ||
tal:condition="view/on_workspace"> | ||
Roster | ||
</a> | ||
<p tal:condition="not:view/on_workspace"> | ||
The roster view is not available outside of a workspace. | ||
</p> | ||
</dt> | ||
</dl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0"?> | ||
<portlets | ||
xmlns:i18n="http://xml.zope.org/namespaces/i18n" | ||
i18n:domain="plone"> | ||
|
||
<portlet | ||
addview="portlets.RosterPortlet" | ||
title="Roster" | ||
description="Give participants access to the roster view"> | ||
<for interface="plone.app.portlets.interfaces.IColumn" /> | ||
</portlet> | ||
<assignment | ||
type="portlets.RosterPortlet" | ||
manager="plone.rightcolumn" | ||
category="content_type" | ||
key="ploneintranet.workspace.workspacefolder" | ||
name="portlets.RosterPortlet" | ||
insert-before="*" | ||
> | ||
</assignment> | ||
|
||
</portlets> |