Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why MenuCategory is defined as a string and it is inconvenient to add an icon. #1730

Open
allphfa opened this issue Oct 15, 2018 · 0 comments

Comments

@allphfa
Copy link

allphfa commented Oct 15, 2018

Can't we use it? We need to patch it.

a = MenuCategory('Info', icon_type=ICON_TYPE_GLYPH, icon_value='icon-desktop')

admin.add_view(UserA(User, category=a, menu_icon_type=ICON_TYPE_GLYPH, menu_icon_value='icon-desktop'))
admin.add_view(ModelView(Role, category=a, menu_icon_type=ICON_TYPE_GLYPH, menu_icon_value='icon-desktop'))

base.html line: 6

    <title>{%- block title -%}{% if admin_view.category %}
      {% if admin_view.category.__class__ == ''.__class__ %}
          {{ admin_view.category }}
      {% else %}
          {{ admin_view.category.name }}
      {% endif %}
       - {% endif %}{{ admin_view.name }} - {{ admin_view.admin.name }}
      {% endblock %}</title>

layout.html line: 29

          <a class="dropdown-toggle" href="javascript:void(0)">
            {% if item.__class__ != ''.__class__ %}
                {% set item = item.name %}
            {% endif %}
            {{ menu_icon(item) }} <span class="menu-text">{{ item.name }}</span><b class="arrow icon-angle-down"></b>
          </a>

This is a complete theme.

admin theme

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant