Secretly fix searchbar not showing term when searching

This commit is contained in:
CodeSteak 2020-06-17 00:17:50 +02:00
parent 44df9e4b4f
commit 86e3ced19b
2 changed files with 5 additions and 1 deletions

View File

@ -47,6 +47,9 @@ public class ShopSearchController {
return "error/404"; return "error/404";
} }
// Show term in search box
model.addAttribute("searchterm", term != null ? term : "");
return "shop/search"; return "shop/search";
} }
} }

View File

@ -11,7 +11,8 @@
<div class='content-width bar-flex'> <div class='content-width bar-flex'>
<a class="button no-padding" href="/"><img class="logo" th:src="@{/img/ecom-logo-base.svg}"></a> <a class="button no-padding" href="/"><img class="logo" th:src="@{/img/ecom-logo-base.svg}"></a>
<form class='spacer input-icon secondary' th:action="@{/shop/search}" method="GET"> <form class='spacer input-icon secondary' th:action="@{/shop/search}" method="GET">
<input type="text" name="term" placeholder="Nach Produkten suchen..."/> <input type="text" name="term" placeholder="Nach Produkten suchen..."
th:value="${searchterm != null ? searchterm : ''}"/>
<button>Finden</button> <button>Finden</button>
</form> </form>
<a th:unless="${user}" class="button" th:href="@{/login}">Login</a> <a th:unless="${user}" class="button" th:href="@{/login}">Login</a>