better control of filtering (ignore filters and hinding of children in management views); use additional predicates for listings in lobo layouts
This commit is contained in:
parent
e59356f627
commit
ef334a50fb
4 changed files with 27 additions and 12 deletions
|
@ -11,7 +11,8 @@
|
|||
<div class="row">
|
||||
<span class="label">Sub-Concepts</span>:
|
||||
<span class="field"
|
||||
tal:repeat="concept view/children">
|
||||
tal:repeat="concept python:
|
||||
view.getChildren(topLevelOnly=False, useFilter=False)">
|
||||
<a href="#"
|
||||
tal:attributes="href concept/url"
|
||||
tal:content="concept/title">subtask</a>
|
||||
|
|
|
@ -276,7 +276,8 @@ class ConceptView(BaseView):
|
|||
if r.order != pos:
|
||||
r.order = pos
|
||||
|
||||
def getChildren(self, topLevelOnly=True, sort=True, noDuplicates=True):
|
||||
def getChildren(self, topLevelOnly=True, sort=True, noDuplicates=True,
|
||||
useFilter=True):
|
||||
form = self.request.form
|
||||
#if form.get('loops.viewName') == 'index.html' and self.editable:
|
||||
if self.editable:
|
||||
|
@ -311,10 +312,12 @@ class ConceptView(BaseView):
|
|||
break
|
||||
if skip:
|
||||
continue
|
||||
if useFilter:
|
||||
options = IOptions(adapted(r.predicate), None)
|
||||
if options is not None and options('hide_children'):
|
||||
continue
|
||||
if fv.check(r.context):
|
||||
if not fv.check(r.context):
|
||||
continue
|
||||
yield r
|
||||
|
||||
def checkCriteria(self, relation, criteria):
|
||||
|
@ -347,9 +350,10 @@ class ConceptView(BaseView):
|
|||
return result
|
||||
|
||||
def isHidden(self, pr):
|
||||
if (getName(pr.second.conceptType) in
|
||||
IOptions(adapted(pr.predicate))('hide_parents_for', [])):
|
||||
#IOptions(pr.predicate)('hide_parents_for', [])):
|
||||
predOptions = IOptions(adapted(pr.predicate))
|
||||
if predOptions('hide_parents'):
|
||||
return True
|
||||
if (getName(pr.second.conceptType) in predOptions('hide_parents_for', [])):
|
||||
return True
|
||||
hideRoles = None
|
||||
options = component.queryAdapter(adapted(pr.first), IOptions)
|
||||
|
|
|
@ -23,7 +23,8 @@
|
|||
</div>
|
||||
<div metal:use-macro="views/relation_macros/clients" />
|
||||
|
||||
<div tal:define="items view/children;
|
||||
<div tal:define="items python:
|
||||
view.getChildren(topLevelOnly=False, useFilter=False);
|
||||
action string:remove;
|
||||
qualifier string:children;
|
||||
summary string:Currently assigned objects;
|
||||
|
|
|
@ -159,11 +159,20 @@ class BasePart(Base):
|
|||
gridPattern = []
|
||||
showImage = True
|
||||
|
||||
@Lazy
|
||||
def childPredicates(self):
|
||||
preds = [self.defaultPredicate]
|
||||
for name in ['ispartof', 'hasoverview']:
|
||||
pred = self.conceptManager.get(name)
|
||||
if pred is not None:
|
||||
preds.append(pred)
|
||||
return preds
|
||||
|
||||
def getChildren(self):
|
||||
subtypeNames = (self.params.get('subtypes') or [''])[0].split(',')
|
||||
subtypes = [self.conceptManager[st] for st in subtypeNames if st]
|
||||
result = []
|
||||
childRels = self.context.getChildRelations([self.defaultPredicate])
|
||||
childRels = self.context.getChildRelations(self.childPredicates)
|
||||
if subtypes:
|
||||
childRels = [r for r in childRels
|
||||
if r.second.conceptType in subtypes]
|
||||
|
|
Loading…
Add table
Reference in a new issue