caio.co/de/tablier

Display link to remove selected filters when possible

Id
965730d1d91745628a79ce93846adc8817aacee5
Author
Caio
Commit time
2019-05-21T12:14:17+02:00

Modified src/main/java/co/caio/tablier/Generator.java

@@ -132,6 +132,8
.numRecipes(numRecipes)
.previousPageHref("/previous")
.nextPageHref("/next")
+ .numAppliedFilters(2)
+ .clearFiltersUrl("#cleared")
.addAllRecipes(samples(10))
.sidebar(sidebar)
.build();

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

@@ -21,6 +21,11
}

@Value.Default
+ default String clearFiltersUrl() {
+ return "";
+ }
+
+ @Value.Default
default String previousPageHref() {
return "";
}

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

@@ -20,6 +20,7
} else if (sr.numAppliedFilters() > 1) {
with <em>@sr.numAppliedFilters()</em> filters applied
}
+ @if (!sr.clearFiltersUrl().isBlank()) { (<a href="@sr.clearFiltersUrl()" title="Remove all selected filters">remove</a>) }
has matched @sr.numMatching() @if (sr.numMatching() == 1) { recipe } else { recipes } (Out of @sr.numRecipes()). @if (sr.numMatching() > 0) { Displaying results from @sr.paginationStart() to @sr.paginationEnd(). } else if (sr.numAppliedFilters() > 0) { Try deselecting filters and/or changing your query. } else { Try changing your query. }
<p class="is-hidden-tablet has-text-centered">
<a href="#sidebar">Filter Results</a>