fixed BUGs 22 and 23 - both relate to the HTML forms being different for the search and viewing data, so changing one when the other was set, did not pass the values through, e.g. search term not there when you change a viewing option, or after searching, it did not know the grouping options. Fixed from the search side by showing a label of what you are searching for and storing it statically in the viewing form. Sorted by jscript onSubmit func to take 5 viewing options and store the last value in hidden inputs in the search form
This commit is contained in:
@@ -94,8 +94,13 @@
|
||||
</div class="nav-item">
|
||||
</div class="navbar-nav">
|
||||
|
||||
<form class="form-inline my-2 my-lg-0" method="POST" action="/search">
|
||||
<input class="form-control mr-sm-2" type="search" placeholder="by file, date (YYYMMDD) or tag" aria-label="Search" name="term">
|
||||
<form class="form-inline my-2 my-lg-0" method="POST" onSubmit="SetViewingOptionsForSearchForm()" action="/search">
|
||||
<input type="hidden" id="search_noo" name="noo" value="">
|
||||
<input type="hidden" id="search_grouping" name="grouping" value="">
|
||||
<input type="hidden" id="search_how_many" name="how_many" value="">
|
||||
<input type="hidden" id="search_offset" name="offset" value="">
|
||||
<input type="hidden" id="search_size" name="size" value="">
|
||||
<input id="term" class="form-control mr-sm-2" type="search" placeholder="by file, date (YYYMMDD) or tag" aria-label="Search" name="term">
|
||||
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
|
||||
</form>
|
||||
</div class="collapse navbar-collapse">
|
||||
@@ -133,6 +138,35 @@
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
|
||||
<script src="https://cdn.datatables.net/1.10.22/js/dataTables.bootstrap4.min.js"></script>
|
||||
<script>
|
||||
function SetViewingOptionsForSearchForm()
|
||||
{
|
||||
if( $('#noo').length )
|
||||
$('#search_noo').val( $('#noo').val() )
|
||||
else
|
||||
$('#search_noo').val("Oldest")
|
||||
|
||||
if( $('#grouping').length )
|
||||
$('#search_grouping').val( $('#grouping').val() )
|
||||
else
|
||||
$('#search_grouping').val("Day")
|
||||
|
||||
if( $('#how_many').length )
|
||||
$('#search_how_many').val( $('#how_many').val() )
|
||||
else
|
||||
$('#search_how_many').val("10")
|
||||
|
||||
if( $('#offset').length )
|
||||
$('#search_offset').val( $('#offset').val() )
|
||||
else
|
||||
$('#search_offset').val(0)
|
||||
|
||||
if( $('#size').length )
|
||||
$('#search_size').val( $('#size').val() )
|
||||
else
|
||||
$('#search_size').val(128)
|
||||
}
|
||||
</script>
|
||||
{%block script_content %}{% endblock script_content %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,7 +9,10 @@
|
||||
</div>
|
||||
|
||||
<div class="container-fluid">
|
||||
<form method="POST">
|
||||
<form method="POST"">
|
||||
{% if search_term is defined %}
|
||||
<input type="hidden" name="term" id="view_term" value="{{search_term}}">
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="input-group col-lg-4">
|
||||
{{CreateSelect( "noo", noo, ["Oldest", "Newest"], "$('#offset').val(0)")|safe }}
|
||||
@@ -17,8 +20,12 @@
|
||||
<span style="border:0" class="sm-txt my-auto h-100 btn btn-outline-info disabled">grouped by:</span>
|
||||
{{CreateSelect( "grouping", grouping, ["None", "Day", "Week", "Month"])|safe }}
|
||||
</div class="input-group">
|
||||
{% if search_term is defined %}
|
||||
<div class="col my-auto">
|
||||
<span class="alert alert-primary">Searched for: '{{search_term}}'</span>
|
||||
</div class="col my-auto">
|
||||
{% endif %}
|
||||
<div class="col my-auto d-flex justify-content-end">
|
||||
{% set fd=entry_data[0].file_details[0] %}
|
||||
<button id="prev" name="prev" class="sm-txt btn btn-info"><i class="fas fa-arrow-alt-circle-left"></i></button>
|
||||
<span class="sm-txt h-100 my-auto"> {{how_many}} files </span>
|
||||
<button id="next" name="next" class="sm-txt btn btn-info"><i class="fas fa-arrow-alt-circle-right"></i></button>
|
||||
|
||||
Reference in New Issue
Block a user