caio.co/de/tablier

Allow overriding the search form action (preserving filters)

Id
1b579184e0962689c95e6b72cef9bcf6d139fbb2
Author
Caio
Commit time
2019-05-21T11:58:06+02:00

Modified src/main/java/co/caio/tablier/model/SiteInfo.java

@@ -19,6 +19,11
}

@Value.Default
+ default String searchAction() {
+ return "/search";
+ }
+
+ @Value.Default
default String searchValue() {
return "";
}

Modified src/main/java/co/caio/tablier/view/searchform.rocker.html

@@ -8,7 +8,7
<h2 class="subtitle">
Over a million recipes, zero ads.
</h2>
-<form action="/search?#results" method="get">
+<form action="@site.searchAction()" method="get">
<div class="field has-addons has-addons-centered">
<div class="control">
<input class="input" @if (site.isUnstable()) { disabled } type="search" name="q" @if (site.searchIsAutoFocus()) { autofocus } placeholder="Ingredients, diets, etc." value="@site.searchValue()">