diff --git a/mayan/apps/appearance/templates/appearance/base.html b/mayan/apps/appearance/templates/appearance/base.html
index 48f9a3f09f..a4ce1daf29 100644
--- a/mayan/apps/appearance/templates/appearance/base.html
+++ b/mayan/apps/appearance/templates/appearance/base.html
@@ -101,18 +101,20 @@
{% if form_navigation_links %}
- {% with form_navigation_links as object_navigation_links %}
- {% with 'true' as hide_active_anchor %}
- {% with 'active' as link_class_active %}
- {% with 'list-group-item btn-sm' as link_classes %}
- {% include 'navigation/generic_navigation.html' %}
- {% endwith %}
- {% endwith %}
- {% endwith %}
- {% endwith %}
+ {% for object_navigation_links in form_navigation_links %}
+ {% with 'true' as hide_active_anchor %}
+ {% with 'active' as link_class_active %}
+ {% with 'list-group-item btn-sm' as link_classes %}
+ {% include 'navigation/generic_navigation.html' %}
+ {% endwith %}
+ {% endwith %}
+ {% endwith %}
+ {% endfor %}
{% endif %}
{% endif %}
diff --git a/mayan/apps/appearance/templates/appearance/generic_list_horizontal.html b/mayan/apps/appearance/templates/appearance/generic_list_horizontal.html
index 6509ba9637..34527c7a36 100644
--- a/mayan/apps/appearance/templates/appearance/generic_list_horizontal.html
+++ b/mayan/apps/appearance/templates/appearance/generic_list_horizontal.html
@@ -13,7 +13,9 @@
- {% get_menu_links 'front page menu' as object_navigation_links %}
+ {% get_menu_links 'front page menu' as resolved_links %}
{% with 'navigation/large_button_link.html' as link_template %}
{% with 'col-xs-12 col-sm-6 col-md-4 col-lg-4' as div_class %}
- {% include 'navigation/generic_navigation.html' %}
+ {% for object_navigation_links in resolved_links %}
+ {% include 'navigation/generic_navigation.html' %}
+ {% endfor %}
{% endwith %}
{% endwith %}
diff --git a/mayan/apps/common/views.py b/mayan/apps/common/views.py
index 91199322b7..d7165420bb 100644
--- a/mayan/apps/common/views.py
+++ b/mayan/apps/common/views.py
@@ -459,7 +459,7 @@ class SetupListView(TemplateView):
def get_context_data(self, **kwargs):
data = super(SetupListView, self).get_context_data(**kwargs)
data.update({
- 'object_navigation_links': menu_setup.resolve(context=RequestContext(self.request)),
+ 'resolved_links': menu_setup.resolve(context=RequestContext(self.request)),
'title': _('Setup items'),
})
return data
@@ -471,7 +471,7 @@ class ToolsListView(TemplateView):
def get_context_data(self, **kwargs):
data = super(ToolsListView, self).get_context_data(**kwargs)
data.update({
- 'object_navigation_links': menu_tools.resolve(context=RequestContext(self.request)),
+ 'resolved_links': menu_tools.resolve(context=RequestContext(self.request)),
'title': _('Tools'),
})
return data
diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py
index 86a6c4deb5..d0f6a502e5 100644
--- a/mayan/apps/navigation/classes.py
+++ b/mayan/apps/navigation/classes.py
@@ -86,29 +86,43 @@ class Menu(object):
pass
for resolved_navigation_object in resolved_navigation_object_list:
- for source, links in self.bound_links.iteritems():
+ resolved_links = []
+
+ for bound_source, links in self.bound_links.iteritems():
try:
- if inspect.isclass(source) and isinstance(resolved_navigation_object, source) or source == CombinedSource(obj=resolved_navigation_object.__class__, view=current_view):
+ if inspect.isclass(bound_source) and isinstance(resolved_navigation_object, bound_source) or source == CombinedSource(obj=resolved_navigation_object.__class__, view=current_view):
for link in links:
resolved_link = link.resolve(context=context, resolved_object=resolved_navigation_object)
if resolved_link:
- result.append(resolved_link)
+ resolved_links.append(resolved_link)
break # No need for further content object match testing
except TypeError:
# When source is a dictionary
pass
+ if resolved_links:
+ result.append(resolved_links)
+
+ resolved_links = []
# View links
for link in self.bound_links.get(current_view, []):
resolved_link = link.resolve(context)
if resolved_link:
- result.append(resolved_link)
+ resolved_links.append(resolved_link)
+
+ if resolved_links:
+ result.append(resolved_links)
+
+ resolved_links = []
# Main menu links
for link in self.bound_links.get(None, []):
resolved_link = link.resolve(context)
if resolved_link:
- result.append(resolved_link)
+ resolved_links.append(resolved_link)
+
+ if resolved_links:
+ result.append(resolved_links)
return result
diff --git a/mayan/apps/navigation/templatetags/navigation_tags.py b/mayan/apps/navigation/templatetags/navigation_tags.py
index e88070b67f..391fe399bb 100644
--- a/mayan/apps/navigation/templatetags/navigation_tags.py
+++ b/mayan/apps/navigation/templatetags/navigation_tags.py
@@ -20,16 +20,20 @@ def get_menus_links(context, names, source=None):
result = []
for name in names.split(','):
- links = Menu.get(name=name).resolve(context)
- if links:
- result.append(links)
+ for links in Menu.get(name=name).resolve(context):
+ if links:
+ result.append(links)
return result
@register.simple_tag(takes_context=True)
def get_multi_item_links_form(context, object_list):
- actions = [(link.url, link.text) for link in Menu.get('multi item menu').resolve(context=context, source=object_list[0])]
+ actions = []
+ for link_set in Menu.get('multi item menu').resolve(context=context, source=object_list[0]):
+ for link in link_set:
+ actions.append((link.url, link.text))
+
form = MultiItemForm(actions=actions)
context.update({'multi_item_form': form, 'multi_item_actions': actions})
return ''