From 9bb782155328262251c89633a6102b2629ec3f9c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Wed, 1 Aug 2012 16:56:03 -0400 Subject: [PATCH] Display horizontal separator only for links that are visible --- apps/navigation/api.py | 9 +++++---- apps/navigation/templates/generic_link_instance.html | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/navigation/api.py b/apps/navigation/api.py index 42c7aa16ec..6a649693cf 100644 --- a/apps/navigation/api.py +++ b/apps/navigation/api.py @@ -73,18 +73,19 @@ class Link(object): # Check to see if link has conditional display if self.condition: - condition_result = self.condition(context) + self.condition_result = self.condition(context) else: - condition_result = True + self.condition_result = True - logger.debug('condition_result: %s', condition_result) + logger.debug('self.condition_result: %s', self.condition_result) - if condition_result: + if self.condition_result: resolved_link = ResolvedLink() resolved_link.text = self.text resolved_link.sprite = self.sprite resolved_link.icon = self.icon resolved_link.permissions = self.permissions + resolved_link.condition_result = self.condition_result try: #args, kwargs = resolve_arguments(context, self.get('args', {})) diff --git a/apps/navigation/templates/generic_link_instance.html b/apps/navigation/templates/generic_link_instance.html index a1f18baf8b..c856e2710e 100644 --- a/apps/navigation/templates/generic_link_instance.html +++ b/apps/navigation/templates/generic_link_instance.html @@ -5,5 +5,5 @@ {% if link.disabled %} {% if link.sprite and not disable_icons %}{% endif %}{{ link.text|capfirst }}{% if link.error %} - {{ link.error }}{% endif %}{% if link.active and not hide_active_anchor %}{% endif %}{% if horizontal %}{% if not forloop.last %} | {% endif %}{% endif %} {% else %} - {% if link.sprite and not disable_icons %}{% endif %}{{ link.text|capfirst }}{% if link.error %} - {{ link.error }}{% endif %}{% if link.active and not hide_active_anchor %}{% endif %}{% if horizontal %}{% if not forloop.last %} | {% endif %}{% endif %} + {% if link.sprite and not disable_icons %}{% endif %}{{ link.text|capfirst }}{% if link.error %} - {{ link.error }}{% endif %}{% if link.active and not hide_active_anchor %}{% endif %}{% if horizontal %}{% if not forloop.last %}{% if link.condition_result %} | {% endif %}{% endif %}{% endif %} {% endif %}