2021-03-13 02:19:42 -07:00
{% extends 'layout.html' %}
2020-02-13 13:13:27 -05:00
{% load buttons %}
{% load helpers %}
2021-04-05 17:13:32 -04:00
{% load render_table from django_tables2 %}
2020-10-21 14:52:50 -04:00
{% load static %}
2020-02-13 13:13:27 -05:00
2021-03-13 02:19:42 -07:00
{% block title %}{{ content_type.model_class|meta:"verbose_name_plural"|bettertitle }}{% endblock %}
{% block controls %}
2021-04-20 12:45:30 -07:00
< div class = "controls mb-2 mx-0" >
2021-03-13 02:19:42 -07:00
< div class = "d-flex flex-wrap justify-content-end" >
2021-04-18 16:42:28 -07:00
{% block extra_controls %}{% endblock %}
2021-03-17 22:25:20 -07:00
{% if permissions.add and 'add' in action_buttons %}
2020-06-25 16:50:35 -04:00
{% add_button content_type.model_class|validated_viewname:"add" %}
2020-02-13 14:07:15 -05:00
{% endif %}
2021-03-17 22:25:20 -07:00
{% if permissions.add and 'import' in action_buttons %}
{% import_button content_type.model_class|validated_viewname:"import" %}
{% endif %}
{% if 'export' in action_buttons %}
{% export_button content_type %}
{% endif %}
2021-03-13 02:19:42 -07:00
< / div >
< / div >
{% endblock %}
{% block content %}
< div class = "row mb-3" >
2021-04-21 11:31:28 -07:00
< div class = "{% if filter_form %}col-9{% else %}col-12{% endif %}" >
2021-04-20 12:45:30 -07:00
< div class = "card" >
< div class = "card-header" >
< div class = "float-end col-md-2 noprint table-controls" >
< div class = "input-group input-group-sm" >
< input type = "text" class = "form-control object-filter" placeholder = "Filter" title = "Filter text (regular expressions supported)" / >
{% if request.user.is_authenticated and table_config_form %}
< button type = "button" class = "btn btn-outline-dark btn-sm" data-bs-toggle = "modal" data-bs-target = "#ObjectTable_config" title = "Configure Table" >
< i class = "mdi mdi-table-eye" > < / i >
< / button >
{% endif %}
< / div >
< / div >
< / div >
< div class = "card-body" >
{% with bulk_edit_url=content_type.model_class|validated_viewname:"bulk_edit" bulk_delete_url=content_type.model_class|validated_viewname:"bulk_delete" %}
{% if permissions.change or permissions.delete %}
< form method = "post" class = "form form-horizontal" >
{% csrf_token %}
< input type = "hidden" name = "return_url" value = "{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" / >
{% if table.paginator.num_pages > 1 %}
< div id = "select_all_box" class = "hidden card noprint" >
< div class = "card-body" >
< div class = "checkbox-inline" >
< label for = "select_all" >
< input type = "checkbox" id = "select_all" name = "_all" / >
Select < strong > all {{ table.rows|length }} {{ table.data.verbose_name_plural }}< / strong > Matching Query
< / label >
< / div >
< div class = "float-end" >
{% if bulk_edit_url and permissions.change %}
< button type = "submit" name = "_edit" formaction = "{% url bulk_edit_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class = "btn btn-warning btn-sm" disabled = "disabled" >
< span class = "mdi mdi-pencil" aria-hidden = "true" > < / span > Edit All
< / button >
{% endif %}
{% if bulk_delete_url and permissions.delete %}
< button type = "submit" name = "_delete" formaction = "{% url bulk_delete_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class = "btn btn-danger btn-sm" disabled = "disabled" >
< span class = "mdi mdi-trash-can-outline" aria-hidden = "true" > < / span > Delete All
< / button >
{% endif %}
< / div >
< / div >
2021-04-14 16:05:08 -07:00
< / div >
2021-04-20 12:45:30 -07:00
{% endif %}
{% include table_template|default:'responsive_table.html' %}
< div class = "float-start noprint bulk-buttons" >
{% block bulk_buttons %}{% endblock %}
2021-04-14 16:05:08 -07:00
{% if bulk_edit_url and permissions.change %}
2021-04-20 12:45:30 -07:00
< button type = "submit" name = "_edit" formaction = "{% url bulk_edit_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class = "btn btn-warning btn-sm" >
2021-04-21 11:31:28 -07:00
< i class = "mdi mdi-pencil" aria-hidden = "true" > < / i > Edit Selected
2021-04-20 12:45:30 -07:00
< / button >
2021-04-14 16:05:08 -07:00
{% endif %}
{% if bulk_delete_url and permissions.delete %}
2021-04-20 12:45:30 -07:00
< button type = "submit" name = "_delete" formaction = "{% url bulk_delete_url %}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}" class = "btn btn-danger btn-sm" >
2021-04-21 11:31:28 -07:00
< i class = "mdi mdi-trash-can-outline" aria-hidden = "true" > < / i > Delete Selected
2021-04-20 12:45:30 -07:00
< / button >
2021-04-14 16:05:08 -07:00
{% endif %}
2020-02-14 13:21:32 -05:00
< / div >
2021-04-20 12:45:30 -07:00
< / form >
{% else %}
{% include table_template|default:'responsive_table.html' %}
2021-04-14 16:05:08 -07:00
{% endif %}
2021-04-20 12:45:30 -07:00
{% endwith %}
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
2021-04-14 16:05:08 -07:00
< / div >
2021-04-20 12:45:30 -07:00
< / div >
2020-02-13 17:11:39 -05:00
< / div >
2021-03-13 02:19:42 -07:00
{% if filter_form %}
< div class = "col-3 noprint" >
{% block sidebar %}{% endblock %}
{% include 'inc/search_panel.html' %}
< / div >
{% endif %}
2020-02-13 13:13:27 -05:00
< / div >
2020-10-23 16:47:53 -04:00
{% table_config_form table table_name="ObjectTable" %}
2020-02-13 13:13:27 -05:00
{% endblock %}