Flask-Admin 菜单和菜单链接模板宏
{% 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' %}
{% elif icon_type == 'image-url' %}
{% endif %}
{% endif %}
{%- endmacro %}
{% macro menu(menu_root=None) %} {% if menu_root is none %}{% set menu_root = admin_view.admin.menu() %}{% endif %} {%- for item in menu_root %} {%- if item.is_category() -%} {% set children = item.get_children() %} {%- if children %} {% set class_name = item.get_class_name() or '' %} {%- if item.is_active(admin_view) %}
{% macro menu_links(links=None) %} {% if links is none %}{% set links = admin_view.admin.menu_links() %}{% endif %} {% for item in links %} {% set class_name = item.get_class_name() %} {% if item.is_accessible() and item.is_visible() %} <li{% if class_name %} class="{{ class_name }}"{% endif %}> {{ menu_icon(item) }}{{ item.name }} {% endif %} {% endfor %} {% endmacro %}
{% macro messages() %} {% with messages = get_flashed_messages(with_categories=True) %} {% if messages %} {% for category, m in messages %} {% if category %} {# alert-error changed to alert-danger in bootstrap 3, mapping is for backwards compatibility #} {% set mapping = {'message': 'info', 'error': 'danger'} %}
原文地址: https://www.cveoy.top/t/topic/jzcO 著作权归作者所有。请勿转载和采集!
- 上一篇: 小程序获取集合记录字段值并赋值给变量
- 下一篇: 为青春喝彩,为运动加油!——致学校田径运动会加油稿