mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-02 05:46:25 -06:00
Split object list and filters into tabs
This commit is contained in:
parent
6ce8dd5ac3
commit
5360967abc
@ -1,24 +1,56 @@
|
|||||||
{% extends 'base/layout.html' %}
|
{% extends 'base/layout.html' %}
|
||||||
{% load buttons %}
|
{% load buttons %}
|
||||||
|
{% load helpers %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
|
|
||||||
{% block title %}{{ title }}{% endblock %}
|
{% block title %}{{ title }}{% endblock %}
|
||||||
|
|
||||||
{% block extra_controls %}{% export_button content_type %}{% endblock %}
|
{% block extra_controls %}{% export_button content_type %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block tabs %}
|
||||||
<div class="row mb-3">
|
<ul class="nav nav-tabs px-3">
|
||||||
<div class="col col-md-7 col-lg-8 col-xl-9 col-xxl-10">
|
{% block tab_items %}
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="connections-list-tab" data-bs-toggle="tab" data-bs-target="#connections-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
|
||||||
|
{{ title }}
|
||||||
|
{% badge table.page.paginator.count %}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{% if filter_form %}
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="filters-form-tab" data-bs-toggle="tab" data-bs-target="#filters-form" type="button" role="tab" aria-controls="object-list" aria-selected="false">
|
||||||
|
Filters
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock tab_items %}
|
||||||
|
</ul>
|
||||||
|
{% endblock tabs %}
|
||||||
|
|
||||||
|
{% block content-wrapper %}
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
{# Conncetions list #}
|
||||||
|
<div class="tab-pane show active" id="connections-list" role="tabpanel" aria-labelledby="connections-list-tab">
|
||||||
{% include 'inc/table_controls.html' %}
|
{% include 'inc/table_controls.html' %}
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<div class="card-body">
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
{% render_table table 'inc/table.html' %}
|
{% render_table table 'inc/table.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
|
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{# Filter form #}
|
||||||
{% if filter_form %}
|
{% if filter_form %}
|
||||||
|
<div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
|
||||||
{% include 'inc/filter_list.html' %}
|
{% include 'inc/filter_list.html' %}
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock content-wrapper %}
|
||||||
|
@ -22,9 +22,31 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block tabs %}
|
||||||
<div class="row">
|
<ul class="nav nav-tabs px-3">
|
||||||
<div class="col col-md-7 col-lg-8 col-xl-9 col-xxl-10">
|
{% block tab_items %}
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="rack-elevations-tab" data-bs-toggle="tab" data-bs-target="#rack-elevations" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
|
||||||
|
Rack Elevations
|
||||||
|
{% badge page.paginator.count %}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{% if filter_form %}
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="filters-form-tab" data-bs-toggle="tab" data-bs-target="#filters-form" type="button" role="tab" aria-controls="object-list" aria-selected="false">
|
||||||
|
Filters
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock tab_items %}
|
||||||
|
</ul>
|
||||||
|
{% endblock tabs %}
|
||||||
|
|
||||||
|
{% block content-wrapper %}
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
{# Rack elevations #}
|
||||||
|
<div class="tab-pane show active" id="rack-elevations" role="tabpanel" aria-labelledby="rack-elevations-tab">
|
||||||
{% if page %}
|
{% if page %}
|
||||||
<div style="white-space: nowrap; overflow-x: scroll;">
|
<div style="white-space: nowrap; overflow-x: scroll;">
|
||||||
{% for rack in page %}
|
{% for rack in page %}
|
||||||
@ -57,6 +79,13 @@
|
|||||||
<p>No Racks Found</p>
|
<p>No Racks Found</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{# Filter form #}
|
||||||
|
{% if filter_form %}
|
||||||
|
<div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
|
||||||
{% include 'inc/filter_list.html' %}
|
{% include 'inc/filter_list.html' %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endif %}
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock content-wrapper %}
|
||||||
|
@ -23,9 +23,35 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endblock controls %}
|
{% endblock controls %}
|
||||||
|
|
||||||
{% block content %}
|
{% block tabs %}
|
||||||
{% if table.paginator.num_pages > 1 %}
|
<ul class="nav nav-tabs px-3">
|
||||||
{% with bulk_edit_url=content_type.model_class|validated_viewname:"bulk_edit" bulk_delete_url=content_type.model_class|validated_viewname:"bulk_delete" %}
|
{% block tab_items %}
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link active" id="object-list-tab" data-bs-toggle="tab" data-bs-target="#object-list" type="button" role="tab" aria-controls="edit-form" aria-selected="true">
|
||||||
|
{{ content_type.model_class|meta:"verbose_name_plural"|bettertitle }}
|
||||||
|
{% badge table.page.paginator.count %}
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{% if filter_form %}
|
||||||
|
<li class="nav-item" role="presentation">
|
||||||
|
<button class="nav-link" id="filters-form-tab" data-bs-toggle="tab" data-bs-target="#filters-form" type="button" role="tab" aria-controls="object-list" aria-selected="false">
|
||||||
|
Filters
|
||||||
|
</button>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock tab_items %}
|
||||||
|
</ul>
|
||||||
|
{% endblock tabs %}
|
||||||
|
|
||||||
|
{% block content-wrapper %}
|
||||||
|
<div class="tab-content">
|
||||||
|
|
||||||
|
{# Object list #}
|
||||||
|
<div class="tab-pane show active" id="object-list" role="tabpanel" aria-labelledby="object-list-tab">
|
||||||
|
{% if table.paginator.num_pages > 1 %}
|
||||||
|
|
||||||
|
{# "Select all" form #}
|
||||||
|
{% with bulk_edit_url=content_type.model_class|validated_viewname:"bulk_edit" bulk_delete_url=content_type.model_class|validated_viewname:"bulk_delete" %}
|
||||||
<div id="select-all-box" class="d-none card noprint">
|
<div id="select-all-box" class="d-none card noprint">
|
||||||
<form method="post" class="form col-md-12">
|
<form method="post" class="form col-md-12">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
@ -51,15 +77,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{# Object table #}
|
{# Object table controls #}
|
||||||
<div class="row">
|
|
||||||
<div class="col {% if filter_form %}col-md-7 col-lg-8 col-xl-9 col-xxl-10{% else %}col-12{% endif %}">
|
|
||||||
{# Object list filter, table config #}
|
|
||||||
{% include 'inc/table_controls.html' with table_modal="ObjectTable_config" %}
|
{% include 'inc/table_controls.html' with table_modal="ObjectTable_config" %}
|
||||||
|
|
||||||
|
{# Object table #}
|
||||||
|
<div class="card">
|
||||||
|
<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" %}
|
{% 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">
|
||||||
@ -90,11 +116,19 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
|
{% include 'inc/paginator.html' with paginator=table.paginator page=table.page %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{# Filter form #}
|
||||||
{% if filter_form %}
|
{% if filter_form %}
|
||||||
|
<div class="tab-pane show" id="filters-form" role="tabpanel" aria-labelledby="filters-form-tab">
|
||||||
{% include 'inc/filter_list.html' %}
|
{% include 'inc/filter_list.html' %}
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% table_config_form table table_name="ObjectTable" %}
|
|
||||||
{% endblock content %}
|
{# Table config form #}
|
||||||
|
{% table_config_form table table_name="ObjectTable" %}
|
||||||
|
{% endblock content-wrapper %}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
{% load form_helpers %}
|
{% load form_helpers %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
|
|
||||||
<div class="col col-md-5 col-lg-4 col-xl-3 col-xxl-2 noprint">
|
<form action="." method="get">
|
||||||
<form action="." method="get">
|
<div class="card">
|
||||||
<div class="card small">
|
|
||||||
<h5 class="card-header">
|
|
||||||
Field Filters
|
|
||||||
</h5>
|
|
||||||
<div class="card-body overflow-visible d-flex flex-wrap justify-content-between py-3">
|
<div class="card-body overflow-visible d-flex flex-wrap justify-content-between py-3">
|
||||||
{% for field in filter_form.hidden_fields %}
|
{% for field in filter_form.hidden_fields %}
|
||||||
{{ field }}
|
{{ field }}
|
||||||
@ -61,5 +57,4 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user