From 892a7f77ae3225f2c7beaf4d5fc66b164936b4f4 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Sun, 18 Mar 2012 03:33:58 -0400 Subject: [PATCH] Simply and convert base tempalte navigation render code --- apps/main/templates/base.html | 164 +++++++++++++--------------------- 1 file changed, 61 insertions(+), 103 deletions(-) diff --git a/apps/main/templates/base.html b/apps/main/templates/base.html index 5e19d2be34..aab2d8fb24 100644 --- a/apps/main/templates/base.html +++ b/apps/main/templates/base.html @@ -240,47 +240,27 @@ {% endblock %} {% block web_theme_secondary_navigation %} - {% if navigation_object_list %} - {% for navigation_object_dict in navigation_object_list %} - {% copy_variable navigation_object_dict.object as "navigation_object_name" %} - {% get_object_navigation_links "form_header" as form_navigation_links %} - {% if form_navigation_links %} -
- -
- {% endif %} - {% endfor %} - {% else %} - {% get_object_navigation_links "form_header" as form_navigation_links %} - {% if form_navigation_links %} + {% get_object_navigation_links "form_header" as form_header_navigation_links %} + {% if form_header_navigation_links %} +
+ {% for object_reference, object_links in form_header_navigation_links.items %}
    - {% with form_navigation_links as object_navigation_links %} - {% with "true" as as_li %} - {% with "true" as hide_active_anchor %} - {% with "active" as li_class_active %} - {% with "first" as li_class_first %} - {% include "generic_navigation.html" %} - {% endwith %} - {% endwith %} - {% endwith %} - {% endwith %} - {% endwith %} + {% with object_links as links %} + {% with "true" as as_li %} + {% with "true" as hide_active_anchor %} + {% with "active" as li_class_active %} + {% with "first" as li_class_first %} + {% include "generic_navigation.html" %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %} + {% endwith %}
-
- {% endif %} +
+ {% endfor %} + {% endif %} {% endblock %} @@ -298,84 +278,62 @@ {% endwith %} {% endif %} - {% get_object_navigation_links "secondary_menu" as object_navigation_links %} - {% if object_navigation_links %} + {% get_object_navigation_links "secondary_menu" as secondary_menu_navigation_links %} + {% if secondary_menu_navigation_links %}

{% trans "Secondary menu" %}

{% endif %} - {% if navigation_object_list %} - {% for navigation_object_dict in navigation_object_list %} - {% copy_variable navigation_object_dict.object as "navigation_object_name" %} - {% get_object_navigation_links as object_navigation_links %} - {% if object_navigation_links %} -
- {% if navigation_object %} - {% if navigation_object_dict.name %} -

{% blocktrans with navigation_object_dict.name as name %}Actions for {{ name }}: {{ navigation_object }}{% endblocktrans %}

- {% else %} -

{% blocktrans %}Actions for: {{ navigation_object }}{% endblocktrans %}

- {% endif %} + + {% get_object_navigation_links as secondary_menu_navigation_links %} + {% if secondary_menu_navigation_links %} +
+ {% for object_reference, object_links in secondary_menu_navigation_links.items %} + {% if object_reference %} + {% if navigation_object_dict.name %} +

{% blocktrans with navigation_object_dict.name as name %}Actions for {{ name }}: {{ object_reference }}{% endblocktrans %}

{% else %} -

{% trans "Available actions" %}

- {% endif %} - -
- {% endif %} - {% get_object_navigation_links "sidebar" as object_navigation_links %} - {% if object_navigation_links %} -
-

{% trans "Other available actions" %}

- -
- {% endif %} - {% endfor %} - {% else %} - {% get_object_navigation_links as object_navigation_links %} - {% if object_navigation_links %} -
- {% if navigation_object %} - {% if object_name %} -

{% blocktrans %}Actions for {{ object_name }}: {{ navigation_object }}{% endblocktrans %}

- {% else %} -

{% blocktrans %}Actions for: {{ navigation_object }}{% endblocktrans %}

+

{% blocktrans %}Actions for: {{ object_reference }}{% endblocktrans %}

{% endif %} {% else %} -

{% trans "Actions" %}

- {% endif %} +

{% trans "Available actions" %}

+ {% endif %} -
- {% endif %} - {% get_object_navigation_links "sidebar" as object_navigation_links %} - {% if object_navigation_links %} -
-

{% trans "Other available actions" %}

- -
- {% endif %} + {% endfor %} +
{% endif %} + {% get_object_navigation_links "sidebar" as sidebar_navigation_links %} + {% if sidebar_navigation_links %} +
+

{% trans "Other available actions" %}

+ +
+ {% endif %} + {% get_sidebar_templates as sidebar_templates %} {% for template in sidebar_templates %} {% with "true" as side_bar %}