Commit 8a66a14b authored by Gustaf Lindqvist's avatar Gustaf Lindqvist

Less whitespace for menu macro

parent fe6f14e6
{% macro menu_icon(item) -%} {% macro menu_icon(item) -%}
{% set icon_type = item.get_icon_type() %} {% set icon_type = item.get_icon_type() %}
{% if icon_type %} {%- if icon_type %}
{% set icon_value = item.get_icon_value() %} {% set icon_value = item.get_icon_value() %}
{% if icon_type == 'glyph' %} {% if icon_type == 'glyph' %}
<i class="{{ icon_value }}"></i> <i class="{{ icon_value }}"></i>
...@@ -13,45 +13,43 @@ ...@@ -13,45 +13,43 @@
{%- endmacro %} {%- endmacro %}
{% macro menu() %} {% macro menu() %}
{% for item in admin_view.admin.menu() %} {%- for item in admin_view.admin.menu() %}
{% if item.is_category() %} {%- if item.is_category() -%}
{% set children = item.get_children() %} {% set children = item.get_children() %}
{% if children %} {%- if children %}
{% set class_name = item.get_class_name() %} {% set class_name = item.get_class_name() %}
{% if item.is_active(admin_view) %} {%- if item.is_active(admin_view) %}
<li class="active dropdown{% if class_name %} {{class_name}}{% endif %}"> <li class="active dropdown{% if class_name %} {{class_name}}{% endif %}">
{% else %} {% else -%}
<li class="dropdown{% if class_name %} {{class_name}}{% endif %}"> <li class="dropdown{% if class_name %} {{class_name}}{% endif %}">
{% endif %} {%- endif %}
<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)"> <a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">{{ menu_icon(item) }}{{ item.name }}<b class="caret"></b></a>
{{ menu_icon(item) }}{{ item.name }}<b class="caret"></b>
</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for child in children %} {%- for child in children -%}
{% set class_name = child.get_class_name() %} {% set class_name = child.get_class_name() %}
{% if child.is_active(admin_view) %} {%- if child.is_active(admin_view) %}
<li class="active{% if class_name %} {{class_name}}{% endif %}"> <li class="active{% if class_name %} {{class_name}}{% endif %}">
{% else %} {% else %}
<li{% if class_name %} class="{{class_name}}"{% endif %}> <li{% if class_name %} class="{{class_name}}"{% endif %}>
{% endif %} {%- endif %}
<a href="{{ child.get_url() }}">{{ menu_icon(child) }}{{ child.name }}</a> <a href="{{ child.get_url() }}">{{ menu_icon(child) }}{{ child.name }}</a>
</li> </li>
{% endfor %} {%- endfor %}
</ul> </ul>
</li> </li>
{% endif %} {% endif %}
{% else %} {%- else %}
{% if item.is_accessible() and item.is_visible() %} {%- if item.is_accessible() and item.is_visible() -%}
{% set class_name = item.get_class_name() %} {% set class_name = item.get_class_name() %}
{% if item.is_active(admin_view) %} {%- if item.is_active(admin_view) %}
<li class="active{% if class_name %} {{class_name}}{% endif %}"> <li class="active{% if class_name %} {{class_name}}{% endif %}">
{% else %} {%- else %}
<li{% if class_name %} class="{{class_name}}"{% endif %}> <li{% if class_name %} class="{{class_name}}"{% endif %}>
{% endif %} {%- endif %}
<a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a> <a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a>
</li> </li>
{% endif %} {%- endif -%}
{% endif %} {% endif -%}
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
......
{% macro menu_icon(item) -%} {% macro menu_icon(item) -%}
{% set icon_type = item.get_icon_type() %} {% set icon_type = item.get_icon_type() %}
{% if icon_type %} {%- if icon_type %}
{% set icon_value = item.get_icon_value() %} {% set icon_value = item.get_icon_value() %}
{% if icon_type == 'glyph' %} {% if icon_type == 'glyph' %}
<i class="glyphicon {{ icon_value }}"></i> <i class="glyphicon {{ icon_value }}"></i>
...@@ -13,42 +13,43 @@ ...@@ -13,42 +13,43 @@
{%- endmacro %} {%- endmacro %}
{% macro menu() %} {% macro menu() %}
{% for item in admin_view.admin.menu() %} {%- for item in admin_view.admin.menu() %}
{% if item.is_category() %} {%- if item.is_category() -%}
{% set children = item.get_children() %} {% set children = item.get_children() %}
{% if children %} {%- if children %}
{% if item.is_active(admin_view) %} {% set class_name = item.get_class_name() %}
{%- if item.is_active(admin_view) %}
<li class="active dropdown{% if class_name %} {{class_name}}{% endif %}"> <li class="active dropdown{% if class_name %} {{class_name}}{% endif %}">
{% else %} {% else -%}
<li class="dropdown{% if class_name %} {{class_name}}{% endif %}"> <li class="dropdown{% if class_name %} {{class_name}}{% endif %}">
{% endif %} {%- endif %}
<a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">{{ menu_icon(item) }}{{ item.name }}<b class="caret"></b></a> <a class="dropdown-toggle" data-toggle="dropdown" href="javascript:void(0)">{{ menu_icon(item) }}{{ item.name }}<b class="caret"></b></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for child in children %} {%- for child in children -%}
{% set class_name = child.get_class_name() %} {% set class_name = child.get_class_name() %}
{% if child.is_active(admin_view) %} {%- if child.is_active(admin_view) %}
<li class="active"{% if class_name %} {{class_name}}{% endif %}> <li class="active{% if class_name %} {{class_name}}{% endif %}">
{% else %} {% else %}
<li{% if class_name %} class="{{class_name}}"{% endif %}> <li{% if class_name %} class="{{class_name}}"{% endif %}>
{% endif %} {%- endif %}
<a href="{{ child.get_url() }}">{{ menu_icon(child) }}{{ child.name }}</a> <a href="{{ child.get_url() }}">{{ menu_icon(child) }}{{ child.name }}</a>
</li> </li>
{% endfor %} {%- endfor %}
</ul> </ul>
</li> </li>
{% endif %} {% endif %}
{% else %} {%- else %}
{% if item.is_accessible() and item.is_visible() %} {%- if item.is_accessible() and item.is_visible() -%}
{% set class_name = item.get_class_name() %} {% set class_name = item.get_class_name() %}
{% if item.is_active(admin_view) %} {%- if item.is_active(admin_view) %}
<li class="active"{% if class_name %} {{class_name}}{% endif %}> <li class="active{% if class_name %} {{class_name}}{% endif %}">
{% else %} {%- else %}
<li{% if class_name %} class="{{class_name}}"{% endif %}> <li{% if class_name %} class="{{class_name}}"{% endif %}>
{% endif %} {%- endif %}
<a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a> <a href="{{ item.get_url() }}">{{ menu_icon(item) }}{{ item.name }}</a>
</li> </li>
{% endif %} {%- endif -%}
{% endif %} {% endif -%}
{% endfor %} {% endfor %}
{% endmacro %} {% endmacro %}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment