mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Introduced SearchTable for improved performance
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
{% extends '_base.html' %}
|
||||
{% load form_helpers %}
|
||||
|
||||
{% block title %}Search{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if request.GET.q %}
|
||||
{% include 'search_form.html' with search_form=form %}
|
||||
@@ -8,33 +10,31 @@
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
{% for obj_type in results %}
|
||||
<h3 id="{{ obj_type.name }}">{{ obj_type.name|title }}</h3>
|
||||
{% include 'table.html' with table=obj_type.table %}
|
||||
{% if obj_type.total > obj_type.table.rows|length %}
|
||||
<h3 id="{{ obj_type.name }}">{{ obj_type.name }}</h3>
|
||||
{% include 'table.html' with table=obj_type.table hide_paginator=True %}
|
||||
{% if obj_type.table.page.has_next %}
|
||||
<a href="{{ obj_type.url }}" class="btn btn-primary pull-right">
|
||||
<span class="fa fa-search" aria-hidden="true"></span>
|
||||
All {{ obj_type.total }} results
|
||||
All {{ obj_type.table.page.paginator.count }} results
|
||||
</a>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="col-md-2" style="padding-top: 20px;">
|
||||
{% if results %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Search Results</strong>
|
||||
</div>
|
||||
<div class="list-group">
|
||||
{% for obj_type in results %}
|
||||
<a href="#{{ obj_type.name }}" class="list-group-item">
|
||||
{{ obj_type.name|title }}
|
||||
<span class="badge">{{ obj_type.total }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<strong>Search Results</strong>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="list-group">
|
||||
{% for obj_type in results %}
|
||||
<a href="#{{ obj_type.name }}" class="list-group-item">
|
||||
{{ obj_type.name }}
|
||||
<span class="badge">{{ obj_type.table.page.paginator.count }}</span>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
|
@@ -4,5 +4,7 @@
|
||||
{# Extends the stock django_tables2 template to provide custom formatting of the pagination controls #}
|
||||
|
||||
{% block pagination %}
|
||||
{% include 'paginator.html' %}
|
||||
{% if not hide_paginator %}
|
||||
{% include 'paginator.html' %}
|
||||
{% endif %}
|
||||
{% endblock pagination %}
|
||||
|
Reference in New Issue
Block a user