mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +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.SearchJsParameter;
|
||||||
import nu.marginalia.search.command.SearchParameters;
|
import nu.marginalia.search.command.SearchParameters;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/** Models the search filters displayed next to the search results */
|
/** Models the search filters displayed next to the search results */
|
||||||
public class SearchFilters {
|
public class SearchFilters {
|
||||||
private final WebsiteUrl url;
|
private final WebsiteUrl url;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public final String currentFilter;
|
||||||
|
|
||||||
// These are necessary for the renderer to access the data
|
// These are necessary for the renderer to access the data
|
||||||
@Getter
|
@Getter
|
||||||
public final RemoveJsOption removeJsOption;
|
public final RemoveJsOption removeJsOption;
|
||||||
@Getter
|
@Getter
|
||||||
public final List<List<Filter>> filterGroups;
|
public final List<List<Filter>> filterGroups;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public SearchFilters(WebsiteUrl url, SearchParameters parameters) {
|
public SearchFilters(WebsiteUrl url, SearchParameters parameters) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
|
||||||
removeJsOption = new RemoveJsOption(parameters);
|
removeJsOption = new RemoveJsOption(parameters);
|
||||||
|
|
||||||
|
currentFilter = parameters.profile().filterId;
|
||||||
|
|
||||||
filterGroups = List.of(
|
filterGroups = List.of(
|
||||||
List.of(
|
List.of(
|
||||||
new Filter("No Filter", SearchProfile.NO_FILTER, parameters),
|
new Filter("No Filter", SearchProfile.NO_FILTER, parameters),
|
||||||
@ -44,6 +50,7 @@ public class SearchFilters {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class RemoveJsOption {
|
public class RemoveJsOption {
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<meta name="robots" content="noindex" />
|
<meta name="robots" content="noindex" />
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body data-filter="{{filters.currentFilter}}">
|
||||||
|
|
||||||
<!-- Hi there, fellow human being :-) -->
|
<!-- Hi there, fellow human being :-) -->
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user