2017-03-29 12:04:57 -04:00
|
|
|
{% extends '_base.html' %}
|
2017-03-29 16:45:25 -04:00
|
|
|
{% load helpers %}
|
2017-03-29 12:04:57 -04:00
|
|
|
{% load form_helpers %}
|
|
|
|
|
2017-03-29 16:05:23 -04:00
|
|
|
{% block title %}Search{% endblock %}
|
|
|
|
|
2017-03-29 12:04:57 -04:00
|
|
|
{% block content %}
|
|
|
|
{% if request.GET.q %}
|
2017-03-29 14:22:27 -04:00
|
|
|
{% include 'search_form.html' with search_form=form %}
|
|
|
|
{% if results %}
|
|
|
|
<div class="row">
|
|
|
|
<div class="col-md-10">
|
|
|
|
{% for obj_type in results %}
|
2017-03-29 16:45:25 -04:00
|
|
|
<h3 id="{{ obj_type.name|lower }}">{{ obj_type.name|bettertitle }}</h3>
|
|
|
|
{% include 'panel_table.html' with table=obj_type.table hide_paginator=True %}
|
2017-12-20 14:09:52 -05:00
|
|
|
<a href="{{ obj_type.url }}" class="btn btn-primary pull-right">
|
|
|
|
<span class="fa fa-arrow-right" aria-hidden="true"></span>
|
|
|
|
{% if obj_type.table.page.has_next %}
|
2017-03-29 16:45:25 -04:00
|
|
|
See all {{ obj_type.table.page.paginator.count }} results
|
2017-12-20 14:09:52 -05:00
|
|
|
{% else %}
|
|
|
|
Refine search
|
|
|
|
{% endif %}
|
|
|
|
</a>
|
2017-03-29 14:22:27 -04:00
|
|
|
<div class="clearfix"></div>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
<div class="col-md-2" style="padding-top: 20px;">
|
2017-03-29 16:05:23 -04:00
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<strong>Search Results</strong>
|
|
|
|
</div>
|
|
|
|
<div class="list-group">
|
|
|
|
{% for obj_type in results %}
|
2017-03-29 16:45:25 -04:00
|
|
|
<a href="#{{ obj_type.name|lower }}" class="list-group-item">
|
|
|
|
{{ obj_type.name|bettertitle }}
|
2017-03-29 16:05:23 -04:00
|
|
|
<span class="badge">{{ obj_type.table.page.paginator.count }}</span>
|
|
|
|
</a>
|
|
|
|
{% endfor %}
|
2017-03-29 12:04:57 -04:00
|
|
|
</div>
|
2017-03-29 16:05:23 -04:00
|
|
|
</div>
|
2017-03-29 14:22:27 -04:00
|
|
|
</div>
|
2017-03-29 12:04:57 -04:00
|
|
|
</div>
|
2017-03-29 14:22:27 -04:00
|
|
|
{% else %}
|
|
|
|
<h3 class="text-muted text-center">No results found</h3>
|
|
|
|
{% endif %}
|
2017-03-29 12:04:57 -04:00
|
|
|
{% else %}
|
|
|
|
<div class="row" style="margin-top: 150px;">
|
|
|
|
<div class="col-sm-4 col-sm-offset-4">
|
|
|
|
<form action="{% url 'search' %}" method="get" class="form form-horizontal">
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<strong>Search</strong>
|
|
|
|
</div>
|
|
|
|
<div class="panel-body">
|
|
|
|
{% render_form form %}
|
|
|
|
</div>
|
|
|
|
<div class="panel-footer text-right">
|
|
|
|
<button type="submit" class="btn btn-primary">
|
|
|
|
<span class="fa fa-search" aria-hidden="true"></span> Search
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|