mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 13:09:00 +00:00
(search) Add data-filter to body as a data attribute
For future shenanigans ;D
This commit is contained in:
parent
5639f0653d
commit
6cd6a615fd
@ -5,24 +5,30 @@ import nu.marginalia.WebsiteUrl;
|
||||
import nu.marginalia.search.command.SearchJsParameter;
|
||||
import nu.marginalia.search.command.SearchParameters;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
/** Models the search filters displayed next to the search results */
|
||||
public class SearchFilters {
|
||||
private final WebsiteUrl url;
|
||||
|
||||
@Getter
|
||||
public final String currentFilter;
|
||||
|
||||
// These are necessary for the renderer to access the data
|
||||
@Getter
|
||||
public final RemoveJsOption removeJsOption;
|
||||
@Getter
|
||||
public final List<List<Filter>> filterGroups;
|
||||
|
||||
|
||||
|
||||
public SearchFilters(WebsiteUrl url, SearchParameters parameters) {
|
||||
this.url = url;
|
||||
|
||||
removeJsOption = new RemoveJsOption(parameters);
|
||||
|
||||
currentFilter = parameters.profile().filterId;
|
||||
|
||||
filterGroups = List.of(
|
||||
List.of(
|
||||
new Filter("No Filter", SearchProfile.NO_FILTER, parameters),
|
||||
@ -44,6 +50,7 @@ public class SearchFilters {
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class RemoveJsOption {
|
||||
|
@ -10,7 +10,7 @@
|
||||
<meta name="robots" content="noindex" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body data-filter="{{filters.currentFilter}}">
|
||||
|
||||
<!-- Hi there, fellow human being :-) -->
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user