remove old route for /search and fix issue where searching for empty string was failing
This commit is contained in:
9
files.py
9
files.py
@@ -505,15 +505,6 @@ def search(search_term):
|
|||||||
move_paths = MovePathDetails()
|
move_paths = MovePathDetails()
|
||||||
return render_template("files.html", page_title='View Files', search_term=search_term, entry_data=entries, OPT=OPT, move_paths=move_paths )
|
return render_template("files.html", page_title='View Files', search_term=search_term, entry_data=entries, OPT=OPT, move_paths=move_paths )
|
||||||
|
|
||||||
################################################################################
|
|
||||||
# /search -> POST version -> only used on form submit when you hit return. This
|
|
||||||
# form just redirects to a GET of /search/<search_term> to trip route above
|
|
||||||
################################################################################
|
|
||||||
@app.route("/search", methods=["POST"])
|
|
||||||
@login_required
|
|
||||||
def search_post():
|
|
||||||
return redirect( "/search/"+request.form['search_term'] )
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# /files/scannow -> allows us to force a check for new files
|
# /files/scannow -> allows us to force a check for new files
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@@ -25,6 +25,15 @@
|
|||||||
.highlight { box-shadow: 0 0 7px 4px #5bc0de }
|
.highlight { box-shadow: 0 0 7px 4px #5bc0de }
|
||||||
.sm-txt { font-size: 0.7rem }
|
.sm-txt { font-size: 0.7rem }
|
||||||
</style>
|
</style>
|
||||||
|
<script>
|
||||||
|
function HandleSearch()
|
||||||
|
{
|
||||||
|
st=$('#search_term').val();
|
||||||
|
if( st != '' ) {
|
||||||
|
document.location.href='/search/'+st
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@@ -103,9 +112,9 @@
|
|||||||
</a>
|
</a>
|
||||||
</div class="nav-item">
|
</div class="nav-item">
|
||||||
|
|
||||||
<form class="d-flex col ms-5" method="POST" action="/search">
|
<form class="d-flex col ms-5" method="POST" onSubmit="HandleSearch(); return false">
|
||||||
<input id="search_term" class="form-control" type="search" placeholder="by file, date (YYYMMDD) or tag" aria-label="Search" name="search_term">
|
<input id="search_term" class="form-control" type="search" placeholder="by file, date (YYYMMDD) or tag" aria-label="Search" name="search_term">
|
||||||
<button class="btn btn-outline-success" onClick="javascript:st=$('#search_term').val(); document.location.href='/search/'+st" type="button">Search</button>
|
<button class="btn btn-outline-success" onClick="HandleSearch()" type="button">Search</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="nav-item dropdown">
|
<div class="nav-item dropdown">
|
||||||
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||||
|
|||||||
Reference in New Issue
Block a user