Integrated noresults with gallery, gallery search bar shows current searches

This commit is contained in:
neviyn 2021-05-07 11:50:51 +01:00
parent 4e7643f976
commit 80195c5081
3 changed files with 24 additions and 23 deletions

View File

@ -73,7 +73,7 @@ class ImageController
} }
} }
} }
} ?: return "noresults" } ?: return "gallery"
model.addAttribute("imagePage", images) model.addAttribute("imagePage", images)
return "gallery" return "gallery"
} }

View File

@ -7,13 +7,31 @@
<body> <body>
<div th:replace="fragments :: navbar"></div> <div th:replace="fragments :: navbar"></div>
<div class="container"> <div class="container">
<div class="row"> <form action="/gallery" class="text-center row row-cols-auto align-items-center mt-2">
<div class="col-2" th:each="image : ${imagePage.content}"> <div class="col-10">
<!--/*@thymesVar id="image" type="uk.co.neviyn.booru.Image"*/--> <!--suppress HtmlFormInputWithoutLabel -->
<img class="img-thumbnail" th:src="'/i/' + ${image.filename}" alt=""/> <input class="form-control" id="imageSearch"
name="tags"
pattern="[a-zA-Z0-9\s_]*"
placeholder="Ex: blue_eyes smile"
th:value="${#request.getParameter('tags')}"
type="search">
</div> </div>
<div class="col-2 d-grid">
<button class="btn btn-primary" type="submit">Search</button>
</div>
</form>
</div>
<div class="row" th:if="${imagePage != null}">
<div class="col-2" th:each="image : ${imagePage.content}">
<!--/*@thymesVar id="image" type="uk.co.neviyn.booru.Image"*/-->
<img alt="" class="img-thumbnail" th:src="'/i/' + ${image.filename}"/>
</div>
</div>
<div class="row" th:if="${imagePage == null}">
<div class="col text-center mt-3">
<p class="lead">No images found with all the specified tags.</p>
</div> </div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -1,17 +0,0 @@
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta th:replace="fragments :: header"/>
<title>No Images Found</title>
</head>
<body>
<div class="container">
<div class="row">
<div class="col text-center">
<p>Couldn't find any images with those tags.</p>
</div>
</div>
</div>
</body>
</html>