Clean up object list view

This commit is contained in:
jeremystretch 2021-07-10 22:06:28 -04:00
parent 726b148aa9
commit 0f99e5fcaa
5 changed files with 146 additions and 147 deletions

View File

@ -95,7 +95,7 @@
{# Page header #} {# Page header #}
{% block header %} {% block header %}
<div class="title-container px-3 py-3"> <div class="title-container px-3 pb-3">
{# Title #} {# Title #}
<div id="content-title"> <div id="content-title">

View File

@ -25,16 +25,14 @@
{% block content %} {% block content %}
{% if filter_form %} {% if filter_form %}
<div class="col col-md-12 noprint">
{% include 'inc/advanced_search.html' %} {% include 'inc/advanced_search.html' %}
</div>
{% endif %} {% endif %}
{% if table.paginator.num_pages > 1 %} {% if table.paginator.num_pages > 1 %}
{% with bulk_edit_url=content_type.model_class|validated_viewname:"bulk_edit" bulk_delete_url=content_type.model_class|validated_viewname:"bulk_delete" %} {% with bulk_edit_url=content_type.model_class|validated_viewname:"bulk_edit" bulk_delete_url=content_type.model_class|validated_viewname:"bulk_delete" %}
<div class="row mb-3"> <div id="select-all-box" class="d-none card noprint">
<div class="row mb-3">
<form method="post" class="form col-md-12"> <form method="post" class="form col-md-12">
{% csrf_token %} {% csrf_token %}
<div id="select-all-box" class="d-none card noprint">
<div class="card-body d-inline-flex justify-content-between align-items-center"> <div class="card-body d-inline-flex justify-content-between align-items-center">
<div class="form-check"> <div class="form-check">
<input type="checkbox" id="select-all" name="_all" class="form-check-input" /> <input type="checkbox" id="select-all" name="_all" class="form-check-input" />
@ -55,16 +53,14 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div>
</form> </form>
</div> </div>
</div>
{% endwith %} {% endwith %}
{% endif %} {% endif %}
{# Object list filter, table config #}
<div class="row mb-3"> <div class="row mb-3">
<div class="col col-md-12">
<div class="card">
<div class="card-header">
<div class="row">
<div class="col col-md-4 offset-md-8 d-flex noprint table-controls"> <div class="col col-md-4 offset-md-8 d-flex noprint table-controls">
<div class="input-group input-group-sm"> <div class="input-group input-group-sm">
<input type="text" class="form-control object-filter" placeholder="Filter" title="Filter text (regular expressions supported)" /> <input type="text" class="form-control object-filter" placeholder="Filter" title="Filter text (regular expressions supported)" />
@ -84,15 +80,19 @@
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="card-body"> {# Object table #}
<div class="row">
<div class="col col-md-12">
{% with bulk_edit_url=content_type.model_class|validated_viewname:"bulk_edit" bulk_delete_url=content_type.model_class|validated_viewname:"bulk_delete" %} {% 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 %} {% if permissions.change or permissions.delete %}
<form method="post" class="form form-horizontal"> <form method="post" class="form form-horizontal">
{% csrf_token %} {% 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 %}" /> <input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />
{% include table_template|default:'inc/responsive_table.html' %} <div class="table-responsive">
{% render_table table 'inc/table.html' %}
</div>
<div class="float-start noprint bulk-buttons"> <div class="float-start noprint bulk-buttons">
{% block bulk_buttons %}{% endblock %} {% block bulk_buttons %}{% endblock %}
{% if bulk_edit_url and permissions.change %} {% if bulk_edit_url and permissions.change %}
@ -115,8 +115,6 @@
{% endwith %} {% endwith %}
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %} {% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
</div> </div>
</div>
</div>
</div> </div>
{% table_config_form table table_name="ObjectTable" %} {% table_config_form table table_name="ObjectTable" %}
{% endblock content %} {% endblock content %}

View File

@ -1,7 +1,8 @@
{% load form_helpers %} {% load form_helpers %}
{% load helpers %} {% load helpers %}
<div class="collapse" id="advanced-search-content"> <div id="advanced-search-content" class="collapse mb-3">
<div class="col col-md-12 noprint">
<form action="." method="get"> <form action="." method="get">
<div class="card"> <div class="card">
<h5 class="card-header"> <h5 class="card-header">
@ -62,4 +63,5 @@
</div> </div>
</div> </div>
</form> </form>
</div>
</div> </div>

View File

@ -1,6 +1,6 @@
{% load helpers %} {% load helpers %}
<div class="paginator float-end text-end my-3"> <div class="paginator float-end text-end">
{% if paginator.num_pages > 1 %} {% if paginator.num_pages > 1 %}
<div class="btn-group btn-group-sm mb-3" role="group" aria-label="Pages"> <div class="btn-group btn-group-sm mb-3" role="group" aria-label="Pages">
{% if page.has_previous %} {% if page.has_previous %}

View File

@ -1,7 +1,6 @@
{% load django_tables2 %} {% load django_tables2 %}
<table{% if table.attrs %} {{ table.attrs.as_html }}{% endif %}> <table{% if table.attrs %} {{ table.attrs.as_html }}{% endif %}>
<caption class="text-center small mt-3"></caption>
{% if table.show_header %} {% if table.show_header %}
<thead> <thead>
<tr> <tr>