37 lines
1.3 KiB
HTML
37 lines
1.3 KiB
HTML
<!-- templates/table.html -->
|
|
{% extends "layout.html" %}
|
|
|
|
{% block title %}{{ title }}{% endblock %}
|
|
|
|
{% block precontent %}
|
|
{% set createButtonLogic %}
|
|
window.location.href = '/{{ entry_route }}/new';
|
|
{% endset %}
|
|
{% set exportButtonLogic %}
|
|
const payload = {ids: [{% for row in rows %}{{ row['id'] }}, {% endfor %}]}
|
|
|
|
export_csv(payload, '{{ csv_route }}');
|
|
{% endset %}
|
|
{% set toolbarButtons %}
|
|
<div class="btn-group">
|
|
{{ buttons.render_button(id='export', icon='box-arrow-up', style='outline-primary rounded-start', logic=exportButtonLogic) }}
|
|
{{ buttons.render_button(id='import', icon='box-arrow-in-down', style='outline-primary', logic='alert("Not implemented yet!")') }}
|
|
{{ buttons.render_button(id='create', icon='plus-lg', logic=createButtonLogic, style='outline-primary rounded-end') }}
|
|
</div>
|
|
{% endset %}
|
|
{{ toolbars.render_toolbar(
|
|
'table',
|
|
left = breadcrumb_macro.render_breadcrumb(breadcrumbs=breadcrumbs),
|
|
right = toolbarButtons
|
|
) }}
|
|
{% endblock %}
|
|
{% block content %}
|
|
{{ tables.dynamic_table(
|
|
id='table',
|
|
headers=header.keys()|list if header else [],
|
|
entry_route=entry_route,
|
|
refresh_url = url_for('frags.rows', model=model_name),
|
|
offset=offset,
|
|
fields=fields
|
|
) }}
|
|
{% endblock %}
|