{% extends 'flask-admin/master.html' %} {% import 'admin/lib.html' as lib with context %} {% import 'admin/static.html' as admin_static with context %} {% import 'flask-admin/model/layout.html' as model_layout with context %} {% import 'flask-admin/actions.html' as actionlib with context %} {% import 'flask-admin/model/row_actions.html' as row_actions with context %} {% block head %} {{ super() }} {{ lib.form_css() }} {% endblock %} {% block body %}
{% block model_menu_bar %} {% if admin_view.can_create %} {# todo: need refactor here#} {%- if admin_view.create_modal -%} {{ lib.add_modal_button(url=get_url('.create_view', url=return_url, modal=True), title=_gettext('Create New Record'), content=_gettext('Create'), btn_class='btn btn-primary btn-sm') }} {% else %} {{ _gettext('Create') }} {%- endif -%} {% endif %} {% if admin_view.can_export %} {{ model_layout.export_options() }} {% endif %} {% block model_menu_bar_before_filters %}{% endblock %} {% if filters %} {{ model_layout.filter_options() }} {% endif %} {% if can_set_page_size %} {# todo: need refactor here#} {{ model_layout.page_size_form(page_size_url) }} {% endif %} {% if actions %} {{ actionlib.dropdown(actions) }} {% endif %} {% if count %} {{_("Count:")}}{{ count }}{% endif %} {% if search_supported %} {{ model_layout.search_form() }} {% endif %} {% block model_menu_bar_after_filters %}{% endblock %} {% endblock %}
{% if filters %} {{ model_layout.filter_form() }}
{% endif %} {% block model_list_table %}
{% block list_header scoped %} {% if actions %} {% endif %} {% block list_row_actions_header %} {% if admin_view.column_display_actions %} {% endif %} {% endblock %} {% for c, name in list_columns %} {% set column = loop.index0 %} {% endfor %} {% endblock %} {% for row in data %} {% block list_row scoped %} {% if actions %} {% endif %} {% block list_row_actions_column scoped %} {% if admin_view.column_display_actions %} {%- endif -%} {% endblock %} {% for c, name in list_columns %} {% endfor %} {% endblock %} {% else %} {% endfor %}
{{_('Actions')}} {% if admin_view.is_sortable(c) %} {% if sort_column == column %} {{ name }} {% if sort_desc %} {% else %} {% endif %} {% else %} {{ name }} {% endif %} {% else %} {{ name }} {% endif %} {% if admin_view.column_descriptions.get(c) %} {% endif %}
{% block list_row_actions scoped %} {% for action in list_row_actions %} {{ action.render_ctx(get_pk_value(row), row) }} {% endfor %} {% endblock %} {% if admin_view.is_editable(c) %} {% set form = list_forms[get_pk_value(row)] %} {% if form.csrf_token %} {{ form[c](pk=get_pk_value(row), display_value=get_value(row, c), csrf=form.csrf_token._value()) }} {% else %} {{ form[c](pk=get_pk_value(row), display_value=get_value(row, c)) }} {% endif %} {% else %} {{ get_value(row, c) }} {% endif %}
{% block empty_list_message %}
{{ admin_view.get_empty_list_message() }}
{% endblock %}
{% endblock %} {% block list_pager %} {% if num_pages is not none %} {{ lib.pager(page, num_pages, pager_url) }} {% else %} {{ lib.simple_pager(page, data|length == page_size, pager_url) }} {% endif %} {% endblock %}
{% block actions %} {{ actionlib.form(actions, get_url('.action_view')) }} {% endblock %} {%- if admin_view.edit_modal or admin_view.create_modal or admin_view.details_modal -%} {{ lib.add_modal_window() }} {%- endif -%}
{% endblock %} {% block tail %} {{ super() }} {{ lib.form_js() }} {{ actionlib.script(_gettext('Please select at least one record.'), actions, actions_confirmation) }} {% endblock %}