allow more control for NodeView subclasses, e.g. login view
This commit is contained in:
parent
3b11a72a81
commit
0dc20ea52f
2 changed files with 11 additions and 3 deletions
|
@ -196,6 +196,7 @@ class BaseView(GenericView, I18NView, SortableMixin):
|
|||
icon = None
|
||||
modeName = 'view'
|
||||
isToplevel = False
|
||||
isVisible = True
|
||||
|
||||
def __init__(self, context, request):
|
||||
context = baseObject(context)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2015 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2016 Helmut Merz helmutm@cy55.de
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -111,7 +111,9 @@ class NodeView(BaseView):
|
|||
parts.extend(getParts(n))
|
||||
return parts
|
||||
|
||||
def update(self):
|
||||
def update(self, topLevel=True):
|
||||
if topLevel and self.view != self:
|
||||
return self.view.update(False)
|
||||
result = super(NodeView, self).update()
|
||||
self.recordAccess()
|
||||
return result
|
||||
|
@ -410,8 +412,9 @@ class NodeView(BaseView):
|
|||
|
||||
@Lazy
|
||||
def menuItems(self):
|
||||
return [NodeView(child, self.request)
|
||||
items = [NodeView(child, self.request).view
|
||||
for child in self.context.getMenuItems()]
|
||||
return [item for item in items if item.isVisible]
|
||||
|
||||
@Lazy
|
||||
def parents(self):
|
||||
|
@ -439,6 +442,10 @@ class NodeView(BaseView):
|
|||
def active(self, item):
|
||||
return item.context == self.context or item.context in self.parents
|
||||
|
||||
@Lazy
|
||||
def authenticationMethod(self):
|
||||
return self.viewAnnotations.get('auth_method') or 'standard'
|
||||
|
||||
# virtual target support
|
||||
|
||||
@Lazy
|
||||
|
|
Loading…
Add table
Reference in a new issue