{# # This file is part of Invenio. # Copyright (C) 2015, 2016 CERN. # # Invenio is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # # Invenio is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Invenio; if not, write to the Free Software Foundation, Inc., # 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. # # Copyright (c) 2014, Serge S. Koval and contributors. See AUTHORS # for more details. # # Some rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Names of the contributors may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL SERGE KOVAL BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #} {% macro menu_icon(item) -%} {% set icon_type = item.get_icon_type() %} {%- if icon_type %} {% set icon_value = item.get_icon_value() %} {% if icon_type == 'glyph' %} {% elif icon_type == 'fa' %} {% elif icon_type == 'image' %} menu image {% elif icon_type == 'image-url' %} menu image {% endif %} {% endif %} {%- endmacro %} {% macro menu_overwrite() %} {%- for item in admin_view.admin.menu() %} {%- if item.is_category() -%} {% set children = item.get_children() %} {%- if children %} {% set class_name = item.get_class_name() %} {%- if item.is_active(admin_view) %}
  • {% else -%}
  • {%- endif %} {% if item.class_name %} {% endif %} {{ item.name }}
  • {% endif %} {%- else %} {%- if item.is_accessible() and item.is_visible() -%} {% set class_name = item.get_class_name() %} {%- if item.is_active(admin_view) %}
  • {%- else %}
  • {%- endif %} {{ menu_icon(item) }}{{ item.name }}
  • {%- endif -%} {% endif -%} {% endfor %} {% endmacro %}