mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-16 04:02:52 -06:00
Search form improvements
This commit is contained in:
parent
afdb24610d
commit
d04436aa0a
@ -33,7 +33,7 @@ OBJ_TYPE_CHOICES = (
|
||||
|
||||
class SearchForm(BootstrapMixin, forms.Form):
|
||||
q = forms.CharField(
|
||||
label='Query'
|
||||
label='Query', widget=forms.TextInput(attrs={'style': 'width: 350px'})
|
||||
)
|
||||
obj_type = forms.ChoiceField(
|
||||
choices=OBJ_TYPE_CHOICES, required=False, label='Type'
|
||||
|
@ -2,15 +2,7 @@
|
||||
{% load render_table from django_tables2 %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row home-search" style="padding: 15px 0px 20px">
|
||||
<div class="col-md-12 text-right">
|
||||
<form action="{% url 'search' %}" method="get" class="form form-inline">
|
||||
{{ search_form.q }}
|
||||
{{ search_form.obj_type }}
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'search_form.html' %}
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-4">
|
||||
<div class="panel panel-default">
|
||||
|
@ -3,18 +3,8 @@
|
||||
|
||||
{% block content %}
|
||||
{% if request.GET.q %}
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-md-offset-4">
|
||||
{# Compressed search form #}
|
||||
<form action="{% url 'search' %}" method="get" class="form form-inline pull-right">
|
||||
{{ form.q }}
|
||||
{{ form.obj_type }}
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<span class="fa fa-search" aria-hidden="true"></span> Search
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% include 'search_form.html' with search_form=form %}
|
||||
{% if results %}
|
||||
<div class="row">
|
||||
<div class="col-md-10">
|
||||
{% for obj_type in results %}
|
||||
@ -27,8 +17,6 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
<div class="clearfix"></div>
|
||||
{% empty %}
|
||||
<h3 class="text-muted">No results found</h3>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="col-md-2" style="padding-top: 20px;">
|
||||
@ -49,6 +37,9 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<h3 class="text-muted text-center">No results found</h3>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{# Larger search form #}
|
||||
<div class="row" style="margin-top: 150px;">
|
||||
|
9
netbox/templates/search_form.html
Normal file
9
netbox/templates/search_form.html
Normal file
@ -0,0 +1,9 @@
|
||||
<div class="row" style="padding-bottom: 20px">
|
||||
<div class="col-md-12 text-center">
|
||||
<form action="{% url 'search' %}" method="get" class="form-inline">
|
||||
{{ search_form.q }}
|
||||
{{ search_form.obj_type }}
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user