% extends [% extends "../../base/templates/base.html" %] % import 'lib.html' as lib with context % import 'static.html' as admin_static with context % import 'layout.html' as model_layout with context % import 'actions.html' as actionlib with context % import 'row_actions.html' as row_actions with context % block body % block model_menu_bar

[# % if model in config.STORE_MODELS Store % elif model in ['user', 'role'] [[ model|title|pluralize ]] % if count ([[ count ]]) % endif % else Content % endif #]

[[ admin_view.model.__name__|pluralize ]] % if count ([[ count ]]) % endif

% if not model in ['user', 'role']
% endif % endblock model_menu_bar % if model in ['user', 'role']
% else
% endif
% if actions [[ actionlib.dropdown(actions) ]] % else
% endif [# % if filters [[ model_layout.filter_form() ]]
% endif #] % if admin_view.can_create
% if admin_view.create_modal [[ lib.add_modal_button(url=get_url('.create_view', url=return_url, modal=True), title='Create New Record', content='Create', btn_class='button is-link') ]] % else Create % endif
% endif
% block model_list_table % block list_header scoped % if actions % endif % for c, name in list_columns % set column = loop.index0 % if name in ('Visible', 'Active') % endfor % block list_row_actions_header % if admin_view.column_display_actions % endif % endblock list_row_actions_header % if sort_by_position % endif % endblock list_header % for row in data % if ('icon-minus-sign' in (get_value(row, 'visible') or get_value(row, 'active'))) % else % endif % block list_row scoped % if actions % endif % for c, name in list_columns % if name in ('Visible', 'Active') % endfor % block list_row_actions_column scoped % if admin_view.column_display_actions % endif % endblock list_row_actions_column % if sort_by_position % endif % endblock list_row % else % endfor
% endif % 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 Action
% endif % 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 list_row_actions scoped
% for action in list_row_actions
% if model == 'user' % if action.title == 'View Record' [[ action.render_ctx(get_pk_value(row), row) ]] % elif current_user.has_role('admin') % if get_pk_value(row)|int > 1 or (get_pk_value(row)|int == 1 and action.title != 'Delete Record') [[ action.render_ctx(get_pk_value(row), row) ]] % endif % elif current_user.has_role('owner') and get_pk_value(row)|int > 1 % if not (current_user.id == get_pk_value(row)|int and action.title == 'Delete Record') [[ action.render_ctx(get_pk_value(row), row) ]] % endif % elif current_user.has_role('contributor') and current_user.id == get_pk_value(row)|int and action.title != 'Delete Record' [[ action.render_ctx(get_pk_value(row), row) ]] % endif % elif ((current_user.has_role('contributor') and action.title == 'Delete Record')) % if current_user.name == get_value(row, 'created_by') [[ action.render_ctx(get_pk_value(row), row) ]] % endif % else [[ action.render_ctx(get_pk_value(row), row) ]] % endif
% endfor
% endblock list_row_actions
% block empty_list_message
[[ admin_view.get_empty_list_message() ]]
% endblock empty_list_message
% 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 list_pager % endblock model_list_table % block actions [[ actionlib.form(actions, get_url('.action_view')) ]] % endblock actions
% endblock body % block tail_js [[ super() ]] [[ actionlib.script('Please select at least one record.', actions, actions_confirmation) ]] % macro get_list_js() [% include admin_filters_js %] [% include admin_list_js %] ## [% include admin_rowsorter_js %] [% include admin_list_moveable_js %] % endmacro % endblock tail_js