summaryrefslogtreecommitdiff
path: root/elm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2021-01-15 14:53:13 +0100
committerYorhel <git@yorhel.nl>2021-01-15 14:53:29 +0100
commite01e2f0adcea9a528e9d99bd86286f5e6dfc6c98 (patch)
treef33bbd596cb6d55d4bfe86d1da96b00c40721182 /elm
parent5d660e60ed2d1f9aa04f8e4424a7856fdd6529d7 (diff)
AdvSearch: Add release list status filter
Unlike the label filters, this one doesn't (yet) include the user ID in the URL. Can always be added later if necessary, but checking the visibility of rlists rows is rather annoying.
Diffstat (limited to 'elm')
-rw-r--r--elm/AdvSearch/Fields.elm7
-rw-r--r--elm/AdvSearch/Set.elm23
2 files changed, 30 insertions, 0 deletions
diff --git a/elm/AdvSearch/Fields.elm b/elm/AdvSearch/Fields.elm
index be59cc95..35062e46 100644
--- a/elm/AdvSearch/Fields.elm
+++ b/elm/AdvSearch/Fields.elm
@@ -163,6 +163,7 @@ nestView dat dd model =
Just f.ptype == List.head model.addtype
&& f.title /= ""
&& (dat.uid /= Nothing || f.title /= "My Labels")
+ && (dat.uid /= Nothing || f.title /= "My List")
&& not (f.title == "Role" && (List.head (List.drop 1 model.addtype)) == Just C) -- No "role" filter for character seiyuu (the seiyuu role is implied, after all)
&& not (Set.member (showQType f.qtype) parents))
showT par t =
@@ -286,6 +287,7 @@ type FieldModel
| FMAniStory (AS.Model Int)
| FMRType (AS.Model String)
| FMLabel (AS.Model Int)
+ | FMRList (AS.Model Int)
| FMSRole (AS.Model String)
| FMHeight (AR.Model Int)
| FMWeight (AR.Model Int)
@@ -327,6 +329,7 @@ type FieldMsg
| FSAniStory (AS.Msg Int)
| FSRType (AS.Msg String)
| FSLabel (AS.Msg Int)
+ | FSRList (AS.Msg Int)
| FSSRole (AS.Msg String)
| FSHeight AR.Msg
| FSWeight AR.Msg
@@ -437,6 +440,7 @@ fields =
, f R "Ero animation" 0 FMAniEro AS.init (AS.animatedFromQuery False)
, f R "Story animation" 0 FMAniStory AS.init (AS.animatedFromQuery True)
, f R "Engine" 0 FMEngine AEng.init AEng.fromQuery
+ , f R "My List" 0 FMRList AS.init AS.rlistFromQuery
, n C C "And/Or"
, n C S "Voice Actor ยป"
@@ -519,6 +523,7 @@ fieldUpdate dat msg_ (num, dd, model) =
(FSAniStory msg, FMAniStory m) -> maps FMAniStory (AS.update msg m)
(FSRType msg, FMRType m) -> maps FMRType (AS.update msg m)
(FSLabel msg, FMLabel m) -> maps FMLabel (AS.update msg m)
+ (FSRList msg, FMRList m) -> maps FMRList (AS.update msg m)
(FSSRole msg, FMSRole m) -> maps FMSRole (AS.update msg m)
(FSHeight msg, FMHeight m) -> maps FMHeight (AR.update msg m)
(FSWeight msg, FMWeight m) -> maps FMWeight (AR.update msg m)
@@ -585,6 +590,7 @@ fieldView dat (_, dd, model) =
FMAniStory m -> f FSAniStory (AS.animatedView True m)
FMRType m -> f FSRType (AS.rtypeView m)
FMLabel m -> f FSLabel (AS.labelView dat m)
+ FMRList m -> f FSRList (AS.rlistView m)
FMSRole m -> f FSSRole (AS.sroleView m)
FMHeight m -> f FSHeight (AR.heightView m)
FMWeight m -> f FSWeight (AR.weightView m)
@@ -630,6 +636,7 @@ fieldToQuery dat (_, _, model) =
FMAniStory m -> AS.toQuery (QInt 14) m
FMRType m -> AS.toQuery (QStr 16) m
FMLabel m -> AS.toQuery (\op v -> QTuple 12 op (Maybe.withDefault 0 dat.uid) v) m
+ FMRList m -> AS.toQuery (QInt 18) m
FMSRole m -> AS.toQuery (QStr 5) m
FMHeight m -> AR.toQuery (QInt 6) (QStr 6) m
FMWeight m -> AR.toQuery (QInt 7) (QStr 7) m
diff --git a/elm/AdvSearch/Set.elm b/elm/AdvSearch/Set.elm
index 80d66089..a60f24df 100644
--- a/elm/AdvSearch/Set.elm
+++ b/elm/AdvSearch/Set.elm
@@ -438,3 +438,26 @@ sroleFromQuery = fromQuery (\q ->
case q of
QStr 5 op v -> Just (op, v)
_ -> Nothing)
+
+
+
+
+-- Release list status
+
+rlistView model =
+ ( case Set.toList model.sel of
+ [] -> b [ class "grayedout" ] [ text "List status" ]
+ [v] -> span [ class "nowrap" ] [ lblPrefix model, text <| Maybe.withDefault "" <| lookup v GT.rlistStatus ]
+ l -> span [ class "nowrap" ] [ lblPrefix model, text <| "List (" ++ String.fromInt (List.length l) ++ ")" ]
+ , \() ->
+ [ div [ class "advheader" ]
+ [ h3 [] [ text "List status" ]
+ , opts model False True ]
+ , ul [] <| List.map (\(k,l) -> li [] [ linkRadio (Set.member k model.sel) (Sel k) [ text l ] ]) GT.rlistStatus
+ ]
+ )
+
+rlistFromQuery = fromQuery (\q ->
+ case q of
+ QInt 18 op v -> Just (op, v)
+ _ -> Nothing)