allow hiding of controller macros, e.g. portlets
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2921 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
36da38c555
commit
10d4a15ca4
5 changed files with 21 additions and 11 deletions
|
@ -8,7 +8,8 @@
|
||||||
<div class="action"
|
<div class="action"
|
||||||
tal:attributes="class action/cssClass;
|
tal:attributes="class action/cssClass;
|
||||||
id action/dialogName|nothing;
|
id action/dialogName|nothing;
|
||||||
title action/description;">
|
title action/description;"
|
||||||
|
i18n:attributes="title">
|
||||||
<a href="#" target="target_window" title="Description text"
|
<a href="#" target="target_window" title="Description text"
|
||||||
tal:omit-tag="not:action/url"
|
tal:omit-tag="not:action/url"
|
||||||
tal:attributes="href action/url;
|
tal:attributes="href action/url;
|
||||||
|
@ -18,7 +19,8 @@
|
||||||
i18n:attributes="title"><img src="#" alt="icon"
|
i18n:attributes="title"><img src="#" alt="icon"
|
||||||
tal:condition="action/icon"
|
tal:condition="action/icon"
|
||||||
tal:attributes="src string:$resourceBase${action/icon};
|
tal:attributes="src string:$resourceBase${action/icon};
|
||||||
alt action/description" />
|
alt action/description"
|
||||||
|
i18n:attributes="alt" />
|
||||||
<span i18n:translate=""
|
<span i18n:translate=""
|
||||||
tal:condition="action/title"
|
tal:condition="action/title"
|
||||||
tal:content="action/title">Action Title</span></a>
|
tal:content="action/title">Action Title</span></a>
|
||||||
|
|
|
@ -83,7 +83,7 @@ class Macros(dict):
|
||||||
|
|
||||||
def __init__(self, controller):
|
def __init__(self, controller):
|
||||||
self.controller = controller
|
self.controller = controller
|
||||||
self.identifiers = set()
|
self.identifiers = {}
|
||||||
|
|
||||||
def register(self, slot, identifier=None, template=None, name=None,
|
def register(self, slot, identifier=None, template=None, name=None,
|
||||||
priority=50, **kw):
|
priority=50, **kw):
|
||||||
|
@ -91,21 +91,28 @@ class Macros(dict):
|
||||||
# make sure a certain resource is only registered once
|
# make sure a certain resource is only registered once
|
||||||
if identifier in self.identifiers:
|
if identifier in self.identifiers:
|
||||||
return
|
return
|
||||||
self.identifiers.add(identifier)
|
#self.identifiers.add(identifier)
|
||||||
|
self.identifiers[identifier] = True
|
||||||
if template is None:
|
if template is None:
|
||||||
template = self.standardTemplate
|
template = self.standardTemplate
|
||||||
if name is None:
|
if name is None:
|
||||||
name = slot
|
name = slot
|
||||||
macro = Macro(template, name, priority, **kw)
|
macro = Macro(template, name, priority, identifier=identifier, **kw)
|
||||||
entry = self.setdefault(slot, [])
|
entry = self.setdefault(slot, [])
|
||||||
entry.append(macro)
|
entry.append(macro)
|
||||||
|
|
||||||
|
def hide(self, identifier):
|
||||||
|
self.identifiers[identifier] = False
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
return list(sorted(self.get(key, []), key=lambda x: x.priority))
|
return [m for m in sorted(self.get(key, []), key=lambda x: x.priority)
|
||||||
|
if self.identifiers.get(m.identifier, True)]
|
||||||
|
|
||||||
|
|
||||||
class Macro(object):
|
class Macro(object):
|
||||||
|
|
||||||
|
identifier = ''
|
||||||
|
|
||||||
def __init__(self, template, name, priority, **kw):
|
def __init__(self, template, name, priority, **kw):
|
||||||
self.template = template
|
self.template = template
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
BIN
browser/icons/ledgrey.png
Normal file
BIN
browser/icons/ledgrey.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 493 B |
|
@ -48,10 +48,11 @@ class Person(object):
|
||||||
def age(self):
|
def age(self):
|
||||||
return self.ageAt(date.today())
|
return self.ageAt(date.today())
|
||||||
|
|
||||||
def ageAt(self, date):
|
def ageAt(self, dt):
|
||||||
if not self.birthDate:
|
bd = self.birthDate
|
||||||
|
if not bd:
|
||||||
return None
|
return None
|
||||||
return int((date - self.birthDate).days/365.25)
|
return int((dt - date(bd.year, bd.month, bd.day)).days/365.25)
|
||||||
|
|
||||||
|
|
||||||
class Address(object):
|
class Address(object):
|
||||||
|
|
|
@ -35,9 +35,9 @@ def simplePublishing():
|
||||||
return StatesDefinition('simple_publishing',
|
return StatesDefinition('simple_publishing',
|
||||||
State('private', 'private', ('show', 'archive', 'remove'), color='red'),
|
State('private', 'private', ('show', 'archive', 'remove'), color='red'),
|
||||||
State('draft', 'draft', ('publish', 'hide', 'archive', 'remove'),
|
State('draft', 'draft', ('publish', 'hide', 'archive', 'remove'),
|
||||||
color='yellow'),
|
color='blue'),
|
||||||
State('published', 'published', ('retract', 'archive'), color='green'),
|
State('published', 'published', ('retract', 'archive'), color='green'),
|
||||||
State('archived', 'archived', ('show', 'remove'), color='lightblue'),
|
State('archived', 'archived', ('show', 'remove'), color='grey'),
|
||||||
State('removed', 'removed', ('show',), icon='cancel.png'),
|
State('removed', 'removed', ('show',), icon='cancel.png'),
|
||||||
Transition('show', 'show', 'draft'),
|
Transition('show', 'show', 'draft'),
|
||||||
Transition('hide', 'hide', 'private'),
|
Transition('hide', 'hide', 'private'),
|
||||||
|
|
Loading…
Add table
Reference in a new issue