prepare for hiding concepts from parents portlet for certain roles
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3836 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
99a4e1ab2d
commit
89ed44a13f
2 changed files with 10 additions and 8 deletions
|
@ -203,8 +203,9 @@ class ConceptView(BaseView):
|
|||
cont = self.controller
|
||||
if cont is None:
|
||||
return
|
||||
if self.parents and (self.globalOptions('showParentsForAnonymous') or
|
||||
not IUnauthenticatedPrincipal.providedBy(self.request.principal)):
|
||||
if self.parentsForPortlet and (
|
||||
self.globalOptions('showParentsForAnonymous') or
|
||||
not IUnauthenticatedPrincipal.providedBy(self.request.principal)):
|
||||
cont.macros.register('portlet_right', 'parents', title=_(u'Parents'),
|
||||
subMacro=concept_macros.macros['parents'],
|
||||
priority=20, info=self)
|
||||
|
@ -324,14 +325,14 @@ class ConceptView(BaseView):
|
|||
return False
|
||||
|
||||
@Lazy
|
||||
def parentsForPortlet(self):
|
||||
return [p for p in self.parents() if not self.isHidden(p.relation)]
|
||||
|
||||
def parents(self):
|
||||
result = []
|
||||
rels = sorted((pr for pr in self.context.getParentRelations()
|
||||
if not self.isHidden(pr)),
|
||||
rels = sorted(self.context.getParentRelations(),
|
||||
key=(lambda x: x.first.title.lower()))
|
||||
for r in rels:
|
||||
result.append(self.childViewFactory(r, self.request))
|
||||
return result
|
||||
yield self.childViewFactory(r, self.request)
|
||||
|
||||
def resources(self):
|
||||
rels = self.context.getResourceRelations()
|
||||
|
|
|
@ -233,7 +233,8 @@
|
|||
<!-- portlets -->
|
||||
|
||||
<metal:actions define-macro="parents">
|
||||
<div tal:repeat="concept macro/info/view/parents|macro/info/parents">
|
||||
<div tal:repeat="
|
||||
concept macro/info/view/parents|macro/info/parentsForPortlet">
|
||||
<a href="#"
|
||||
tal:attributes="href python: view.getUrlForTarget(concept)">
|
||||
<span i18n:translate=""
|
||||
|
|
Loading…
Add table
Reference in a new issue