Add converter layers, redactions app
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -48,19 +48,21 @@ class Link(object):
|
||||
|
||||
def __init__(
|
||||
self, text=None, view=None, args=None, badge_text=None, condition=None,
|
||||
conditional_disable=None, description=None, html_data=None,
|
||||
html_extra_classes=None, icon_class=None, icon_class_path=None,
|
||||
keep_query=False, kwargs=None, name=None, permissions=None,
|
||||
remove_from_query=None, tags=None, url=None
|
||||
conditional_active=None, conditional_disable=None, description=None,
|
||||
html_data=None, html_extra_classes=None, icon_class=None,
|
||||
icon_class_path=None, keep_query=False, kwargs=None, name=None,
|
||||
permissions=None, remove_from_query=None, tags=None, url=None
|
||||
):
|
||||
self.args = args or []
|
||||
self.badge_text = badge_text
|
||||
self.condition = condition
|
||||
self.conditional_active = conditional_active
|
||||
self.conditional_disable = conditional_disable
|
||||
self.description = description
|
||||
self.html_data = html_data
|
||||
self.html_extra_classes = html_extra_classes
|
||||
self.icon_class = icon_class
|
||||
self.icon_class_path = icon_class_path
|
||||
self.keep_query = keep_query
|
||||
self.kwargs = kwargs or {}
|
||||
self.name = name
|
||||
@@ -71,7 +73,13 @@ class Link(object):
|
||||
self.view = view
|
||||
self.url = url
|
||||
|
||||
if icon_class_path:
|
||||
self.process_icon()
|
||||
|
||||
if name:
|
||||
self.__class__._registry[name] = self
|
||||
|
||||
def process_icon(self):
|
||||
if self.icon_class_path:
|
||||
if self.icon_class:
|
||||
raise ImproperlyConfigured(
|
||||
'Specify the icon_class or the icon_class_path but not '
|
||||
@@ -79,17 +87,14 @@ class Link(object):
|
||||
)
|
||||
else:
|
||||
try:
|
||||
self.icon_class = import_string(dotted_path=icon_class_path)
|
||||
self.icon_class = import_string(dotted_path=self.icon_class_path)
|
||||
except ImportError as exception:
|
||||
logger.error(
|
||||
'Exception importing icon: %s; %s', icon_class_path,
|
||||
'Exception importing icon: %s; %s', self.icon_class_path,
|
||||
exception
|
||||
)
|
||||
raise
|
||||
|
||||
if name:
|
||||
self.__class__._registry[name] = self
|
||||
|
||||
def resolve(self, context=None, request=None, resolved_object=None):
|
||||
if not context and not request:
|
||||
raise ImproperlyConfigured(
|
||||
@@ -525,7 +530,13 @@ class ResolvedLink(object):
|
||||
|
||||
@property
|
||||
def active(self):
|
||||
return self.link.view == self.current_view_name
|
||||
conditional_active = self.link.conditional_active
|
||||
if conditional_active:
|
||||
return conditional_active(
|
||||
context=self.context, resolved_link=self
|
||||
)
|
||||
else:
|
||||
return self.link.view == self.current_view_name
|
||||
|
||||
@property
|
||||
def badge_text(self):
|
||||
|
||||
Reference in New Issue
Block a user