diff --git a/netbox/netbox/forms.py b/netbox/netbox/forms.py index 2842668b4..63af2e04b 100644 --- a/netbox/netbox/forms.py +++ b/netbox/netbox/forms.py @@ -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' diff --git a/netbox/templates/home.html b/netbox/templates/home.html index b489d90e5..15965b13f 100644 --- a/netbox/templates/home.html +++ b/netbox/templates/home.html @@ -2,15 +2,7 @@ {% load render_table from django_tables2 %} {% block content %} - +{% include 'search_form.html' %}
diff --git a/netbox/templates/search.html b/netbox/templates/search.html index aca275639..5e72e3396 100644 --- a/netbox/templates/search.html +++ b/netbox/templates/search.html @@ -3,52 +3,43 @@ {% block content %} {% if request.GET.q %} -
-
- {# Compressed search form #} -
- {{ form.q }} - {{ form.obj_type }} - -
-
-
-
-
- {% for obj_type in results %} -

{{ obj_type.name|title }}

- {% include 'table.html' with table=obj_type.table %} - {% if obj_type.total > obj_type.table.rows|length %} - - - All {{ obj_type.total }} results - + {% include 'search_form.html' with search_form=form %} + {% if results %} +
+
+ {% for obj_type in results %} +

{{ obj_type.name|title }}

+ {% include 'table.html' with table=obj_type.table %} + {% if obj_type.total > obj_type.table.rows|length %} + + + All {{ obj_type.total }} results + + {% endif %} +
+ {% endfor %} +
+
+ {% if results %} +
+
+ Search Results +
+
+ {% for obj_type in results %} + + {{ obj_type.name|title }} + {{ obj_type.total }} + + {% endfor %} +
+
{% endif %} -
- {% empty %} -

No results found

- {% endfor %} +
-
- {% if results %} -
-
- Search Results -
-
- {% for obj_type in results %} - - {{ obj_type.name|title }} - {{ obj_type.total }} - - {% endfor %} -
-
- {% endif %} -
-
+ {% else %} +

No results found

+ {% endif %} {% else %} {# Larger search form #}
diff --git a/netbox/templates/search_form.html b/netbox/templates/search_form.html new file mode 100644 index 000000000..b60d879b7 --- /dev/null +++ b/netbox/templates/search_form.html @@ -0,0 +1,9 @@ +
+
+
+ {{ search_form.q }} + {{ search_form.obj_type }} + +
+
+