summaryrefslogtreecommitdiff
path: root/elm/Lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-02-28 10:05:00 +0100
committerYorhel <git@yorhel.nl>2020-02-28 10:05:08 +0100
commit03106135b8d4f0c2c0387991133cc3205957d68b (patch)
treee66b8249a7a6f8bae8f78c8a2b573d3394fb399c /elm/Lib
parent018cbf36fe8e33818759909d8ff4fbda87fa3f62 (diff)
v2rw/RelEdit: Add visual novel relation editing
And a few minor styling fixes.
Diffstat (limited to 'elm/Lib')
-rw-r--r--elm/Lib/Api.elm1
-rw-r--r--elm/Lib/Autocomplete.elm15
-rw-r--r--elm/Lib/ExtLinks.elm2
3 files changed, 17 insertions, 1 deletions
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