mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-23 00:12:15 +00:00
Improve search logic and allow search of event archive (#248)
* Added search to person, venue, organisation and event archive
* Added search to invoice archive
* Added event search to homepage
* Tidy up event search logic and optimise
* Fixed merge issues
* Stopped 404 on failed search
* Set default ordering of people, organisations & venues to alphabetical (rather than order of addition to database)
* Added invoice search to home page (if you have permissions)
* Made invoice archive sort by reverse invoice date (rather than order added to database)
* Added search help page (very pretty)
* Made single search box for all search types
* FIX: Missing date field breaking archive view
* FEAT: Add omnisearch to header
Tis a bit broken on mobile at the moment...
* CHORE: Conform old code to pep8
* FIX: Select the event form, not the search one in tests!
* Revert "FEAT: Add omnisearch to header"
This reverts commit 6bcb242d6b because it caused MANY more problems than anticipated...
* FIX: Stop 404 on failed search, again
* FEAT: Basic testing of search
* Use a tooltip to help explain the UX
Obviously since it needs a tooltip it isn't brilliant UX but the best I can think of for now...
Co-authored-by: Tom Price <tom@codedinternet.com>
Co-authored-by: David Taylor <david@taylorhq.com>
Co-authored-by: Arona Jones <aj@aronajones.com>
This commit is contained in:
@@ -5,34 +5,49 @@
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<h2>Event Archive</h2>
|
||||
|
||||
<div class="col-sm-12 col-md-6 pagination">
|
||||
<div class="col-sm-12">
|
||||
<h2>Event Archive</h2>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<form class="form-inline">
|
||||
<div class="form-group">
|
||||
<label for="start">Start</label>
|
||||
<input type="date" name="start" id="start" value="{{ request.GET.start }}" placeholder="Start" class="form-control" />
|
||||
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Start</div>
|
||||
<input type="date" name="start" id="start" value="{{ start|default_if_none:"" }}" placeholder="Start" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="end">End</label>
|
||||
<input type="date" name="end" id="end" value="{% if request.GET.end %}{{ request.GET.end }}{% else %}{% now "Y-m-d" %}{% endif %}" placeholder="End" class="form-control" />
|
||||
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">End</div>
|
||||
<input type="date" name="end" id="end" value="{{ end|default_if_none:"" }}" placeholder="End" class="form-control" />
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" class="btn btn-primary" />
|
||||
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">Keyword</div>
|
||||
<input type="search" name="q" placeholder="Keyword" value="{{ request.GET.q }}"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
|
||||
<div class="input-group">
|
||||
<input type="submit" class="btn btn-primary" value="Search"/>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
{% if is_paginated %}
|
||||
<div class="col-md-6 text-right">
|
||||
{% paginator %}
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col-sm-12">
|
||||
{% if is_paginated %}
|
||||
<div class="pull-right">
|
||||
{% paginator %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
{% with latest as events %}
|
||||
{% include 'RIGS/event_table.html' %}
|
||||
{% endwith %}
|
||||
<div class="col-sm-12">
|
||||
{% with object_list as events %}
|
||||
{% include 'RIGS/event_table.html' %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if is_paginated %}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
{% extends 'base_rigs.html' %}
|
||||
{% block title %}RIGS{% endblock %}
|
||||
|
||||
{% block js %}
|
||||
<script>
|
||||
$(function () {
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="col-sm-12">
|
||||
<h1>R<small>ig</small> I<small>nformation</small> G<small>athering</small> S<small>ystem</small></h1>
|
||||
@@ -36,35 +44,41 @@
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h4 class="panel-title">Search Rigboard</h4>
|
||||
<h4 class="panel-title">Search Rigboard
|
||||
<a href="{% url 'search_help' %}" class="pull-right modal-href"><span class="glyphicon glyphicon-question-sign"</span></a></h4>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#search-options li a').click(function(){
|
||||
$('#searchForm').attr('action', $(this).data('action')).submit();
|
||||
});
|
||||
$('#id_search_input').keypress(function (e) {
|
||||
if (e.which == 13) {
|
||||
$('#searchForm').attr('action', $('#search-options li a').first().data('action')).submit();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
<div class="list-group">
|
||||
<div class="list-group-item">
|
||||
<form class="form" role="form" action="{% url 'person_list' %}" method="GET">
|
||||
<div class="input-group">
|
||||
<input type="search" name="q" class="form-control" placeholder="Search People" />
|
||||
<form id="searchForm" class="form" role="form" method="GET">
|
||||
<div class="input-group" data-toggle="tooltip" title="Use the dropdown button to select what to search. The default is Event Archive.">
|
||||
<input id="id_search_input" type="search" name="q" class="form-control" placeholder="Search..." />
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<form class="form" role="form" action="{% url 'organisation_list' %}" method="GET">
|
||||
<div class="input-group">
|
||||
<input type="search" name="q" class="form-control" placeholder="Search Organisations" />
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="list-group-item">
|
||||
<form class="form" role="form" action="{% url 'venue_list' %}" method="GET">
|
||||
<div class="input-group">
|
||||
<input type="search" name="q" class="form-control" placeholder="Search Venues" />
|
||||
<span class="input-group-btn">
|
||||
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-search"></span></button>
|
||||
<div class="btn-group" role="group">
|
||||
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-search"></span> Search <span class="caret"></span></button>
|
||||
<ul id="search-options" class="dropdown-menu">
|
||||
<li><a data-action="{% url 'event_archive' %}" href="#">Events</a></li>
|
||||
<li><a data-action="{% url 'person_list' %}" href="#">People</a></li>
|
||||
<li><a data-action="{% url 'organisation_list' %}" href="#">Organisations</a></li>
|
||||
<li><a data-action="{% url 'venue_list' %}" href="#">Venues</a></li>
|
||||
{% if perms.RIGS.view_invoice %}
|
||||
<li><a data-action="{% url 'invoice_archive' %}" href="#">Invoices</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
{% paginator %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% block search %}{% endblock %}
|
||||
<div class="table-responsive col-sm-12">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
|
||||
@@ -10,4 +10,15 @@ All Invoices
|
||||
|
||||
{% block description %}
|
||||
<p>This page displays all invoices: outstanding, paid, and void</p>
|
||||
{% endblock %}
|
||||
|
||||
{% block search %}
|
||||
<div class="col-sm-3 col-sm-offset-9">
|
||||
<form class="form form-horizontal col-sm-12">
|
||||
<div class="form-group">
|
||||
<input type="search" name="q" placeholder="Search" value="{{ request.GET.q }}"
|
||||
class="form-control"/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
70
RIGS/templates/RIGS/search_help.html
Normal file
70
RIGS/templates/RIGS/search_help.html
Normal file
@@ -0,0 +1,70 @@
|
||||
{% extends request.is_ajax|yesno:"base_ajax.html,base.html" %}
|
||||
|
||||
{% block title %}Search Help{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
{% if not request.is_ajax %}
|
||||
<div class="col-sm-12">
|
||||
<h1>Search Help</h1>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="col-sm-12">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Searching Events</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
Searches for entire query in:
|
||||
<button type="button" class="btn btn-default btn-xs">name</button>
|
||||
<button type="button" class="btn btn-default btn-xs">description</button> and
|
||||
<button type="button" class="btn btn-default btn-xs">notes</button>
|
||||
</p>
|
||||
<p>You can search for an event by <button type="button" class="btn btn-default btn-xs">event_id</button> by entering an integer, or using the format <code>N01234</code></p>
|
||||
<p>On the search results page you can also specify the date range for the <button type="button" class="btn btn-default btn-xs">start_date</button> of the event</p>
|
||||
<p>Events are sorted in reverse <button type="button" class="btn btn-default btn-xs">start_date</button> order (most recent events at the top)</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Searching People/Organisations/Venues</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
Searches for entire search phrase in:
|
||||
<button type="button" class="btn btn-default btn-xs">name</button>
|
||||
<button type="button" class="btn btn-default btn-xs">email</button>
|
||||
<button type="button" class="btn btn-default btn-xs">address</button>
|
||||
<button type="button" class="btn btn-default btn-xs">notes</button> and
|
||||
<button type="button" class="btn btn-default btn-xs">phone</button>
|
||||
</p>
|
||||
<p>You can search for an entry by <button type="button" class="btn btn-default btn-xs">id</button> by entering an integer</p>
|
||||
<p>Entries are sorted in alphabetical order by <button type="button" class="btn btn-default btn-xs">name</button></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if perms.RIGS.view_invoice %}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Searching Invoices</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<p>
|
||||
Searches for entire search phrase in:
|
||||
<button type="button" class="btn btn-default btn-xs">event__name</button>
|
||||
</p>
|
||||
<p>You can search for an event's invoice by entering the <button type="button" class="btn btn-default btn-xs">event_id</button> using the format <code>N01234</code></p>
|
||||
<p>You can search for an invoice by <button type="button" class="btn btn-default btn-xs">invoice_id</button> using the format <code>#01234</code></p>
|
||||
<p>Entering a raw integer will search by both <button type="button" class="btn btn-default btn-xs">invoice_id</button> and <button type="button" class="btn btn-default btn-xs">event_id</button></p>
|
||||
<p>Entries are sorted in reverse <button type="button" class="btn btn-default btn-xs">invoice_date</button> order</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user