diff --git a/lib/LANraragi/Controller/Api/Search.pm b/lib/LANraragi/Controller/Api/Search.pm index 16c8dbc73..8861d4f58 100644 --- a/lib/LANraragi/Controller/Api/Search.pm +++ b/lib/LANraragi/Controller/Api/Search.pm @@ -34,16 +34,19 @@ sub handle_datatables { # Collection (tags column) if ( $req->param("columns[$i][name]") eq "tags" ) { $categoryfilter = $req->param("columns[$i][search][value]"); - } - # New filter (isnew column) - if ( $req->param("columns[$i][name]") eq "isnew" ) { - $newfilter = $req->param("columns[$i][search][value]") eq "true"; - } + # Specific hacks for the buily-in newonly/untagged selectors + # Those have hardcoded 'category' IDs + if ( $categoryfilter eq "NEW_ONLY" ) { + $newfilter = 1; + $categoryfilter = ""; + } + + if ( $categoryfilter eq "UNTAGGED_ONLY" ) { + $untaggedfilter = 1; + $categoryfilter = ""; + } - # Untagged filter (untagged column) - if ( $req->param("columns[$i][name]") eq "untagged" ) { - $untaggedfilter = $req->param("columns[$i][search][value]") eq "true"; } $i++; } diff --git a/public/js/index.js b/public/js/index.js index 9b2a4ab5b..56f1ff9eb 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -664,7 +664,16 @@ Index.loadCategories = function () { // Pinned categories are shown at the beginning data.sort((b, a) => b.name.localeCompare(a.name)); data.sort((a, b) => b.pinned - a.pinned); - let html = ""; + // Queue some hardcoded categories at the beginning - those are special-cased in the DataTables variant of the search endpoint. + let html = `
+ +
+ +
`; const iteration = (data.length > 10 ? 10 : data.length);