summaryrefslogtreecommitdiff
path: root/elm/Lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-06-29 11:34:34 +0200
committerYorhel <git@yorhel.nl>2020-06-29 11:34:36 +0200
commitd5b13e58abee0b2edbe16705451d498e39235d77 (patch)
tree222c4a0db15ed205bc894d703065300c8e9b94e7 /elm/Lib
parent6831c0b0de4c6581f7d5481e1df4e37754d64b63 (diff)
VN::Edit: Add length/wikidata/renai/anime fields
Completing the "General info" tab. This makes use of the new anime titles import for validation and autocomplete. It does have a bug, though, as it also autocompletes deleted AniDB entries that happen to have been linked to old VN revisions. Need to find a way to mark those for exclusion.
Diffstat (limited to 'elm/Lib')
-rw-r--r--elm/Lib/Api.elm1
-rw-r--r--elm/Lib/Autocomplete.elm15
2 files changed, 16 insertions, 0 deletions
diff --git a/elm/Lib/Api.elm b/elm/Lib/Api.elm
index 4af28ea6..3ad3f3aa 100644
--- a/elm/Lib/Api.elm
+++ b/elm/Lib/Api.elm
@@ -53,6 +53,7 @@ showResponse res =
VNResult _ -> unexp
ProducerResult _ -> unexp
CharResult _ -> unexp
+ AnimeResult _ -> unexp
ImageResult _ -> unexp
diff --git a/elm/Lib/Autocomplete.elm b/elm/Lib/Autocomplete.elm
index 738f6008..7f44ccae 100644
--- a/elm/Lib/Autocomplete.elm
+++ b/elm/Lib/Autocomplete.elm
@@ -10,6 +10,7 @@ module Lib.Autocomplete exposing
, vnSource
, producerSource
, charSource
+ , animeSource
, init
, clear
, update
@@ -36,6 +37,7 @@ import Gen.Traits as GTR
import Gen.VN as GV
import Gen.Producers as GP
import Gen.Chars as GC
+import Gen.Anime as GA
type alias Config m a =
@@ -164,6 +166,19 @@ charSource =
}
+animeSource : SourceConfig m GApi.ApiAnimeResult
+animeSource =
+ { source = Endpoint (\s -> GA.send { search = s })
+ <| \x -> case x of
+ GApi.AnimeResult e -> Just e
+ _ -> Nothing
+ , view = \i ->
+ [ b [ class "grayedout" ] [ text <| "a" ++ String.fromInt i.id ++ ": " ]
+ , text i.title ]
+ , key = \i -> String.fromInt i.id
+ }
+
+
type alias Model a =
{ visible : Bool
, value : String