From 03106135b8d4f0c2c0387991133cc3205957d68b Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 28 Feb 2020 10:05:00 +0100 Subject: v2rw/RelEdit: Add visual novel relation editing And a few minor styling fixes. --- elm/Lib/Api.elm | 1 + elm/Lib/Autocomplete.elm | 15 +++++++++++++++ elm/Lib/ExtLinks.elm | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'elm/Lib') diff --git a/elm/Lib/Api.elm b/elm/Lib/Api.elm index 1863cbf9..a7dd18d8 100644 --- a/elm/Lib/Api.elm +++ b/elm/Lib/Api.elm @@ -45,6 +45,7 @@ showResponse res = Releases _ -> unexp BoardResult _ -> unexp TagResult _ -> unexp + VNResult _ -> unexp expectResponse : (Response -> msg) -> Http.Expect msg diff --git a/elm/Lib/Autocomplete.elm b/elm/Lib/Autocomplete.elm index 733a1175..fa18efc4 100644 --- a/elm/Lib/Autocomplete.elm +++ b/elm/Lib/Autocomplete.elm @@ -6,6 +6,7 @@ module Lib.Autocomplete exposing , Msg , boardSource , tagSource + , vnSource , init , clear , update @@ -28,6 +29,7 @@ import Gen.Types exposing (boardTypes) import Gen.Api as GApi import Gen.Boards as GB import Gen.Tags as GT +import Gen.VN as GV type alias Config m a = @@ -95,6 +97,19 @@ tagSource = } +vnSource : SourceConfig m GApi.ApiVNResult +vnSource = + { source = Endpoint (\s -> GV.send { search = s }) + <| \x -> case x of + GApi.VNResult e -> Just e + _ -> Nothing + , view = \i -> + [ b [ class "grayedout" ] [ text <| "v" ++ String.fromInt i.id ++ ": " ] + , text i.title ] + , key = \i -> String.fromInt i.id + } + + type alias Model a = { visible : Bool , value : String diff --git a/elm/Lib/ExtLinks.elm b/elm/Lib/ExtLinks.elm index 317dc56e..a701039e 100644 --- a/elm/Lib/ExtLinks.elm +++ b/elm/Lib/ExtLinks.elm @@ -85,7 +85,7 @@ update msg model = view : Model a -> Html (Msg a) -view model = Html.form [ class "elm_extlinks", onSubmit Enter ] +view model = Html.form [ onSubmit Enter ] [ table [] <| List.concatMap (\s -> List.indexedMap (\i l -> let (pre, val, suf) = splitPrintf s.fmt l -- cgit v1.2.3