diff options
author | Yorhel <git@yorhel.nl> | 2020-02-28 12:53:44 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2020-02-28 12:55:40 +0100 |
commit | ccc121634fec7d7aa3a36564eeab2330e543e970 (patch) | |
tree | e427f45ceeda01c55260950e2844b22548735586 /elm/Lib/Autocomplete.elm | |
parent | 03106135b8d4f0c2c0387991133cc3205957d68b (diff) |
v2rw/RelEdit: Add producers relation editing
Lots of copy-pasting going on here. Meh.
Also added a couple of overdue server-side validations.
Diffstat (limited to 'elm/Lib/Autocomplete.elm')
-rw-r--r-- | elm/Lib/Autocomplete.elm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/elm/Lib/Autocomplete.elm b/elm/Lib/Autocomplete.elm index fa18efc4..0dd0e9fc 100644 --- a/elm/Lib/Autocomplete.elm +++ b/elm/Lib/Autocomplete.elm @@ -7,6 +7,7 @@ module Lib.Autocomplete exposing , boardSource , tagSource , vnSource + , producerSource , init , clear , update @@ -30,6 +31,7 @@ import Gen.Api as GApi import Gen.Boards as GB import Gen.Tags as GT import Gen.VN as GV +import Gen.Producers as GP type alias Config m a = @@ -110,6 +112,19 @@ vnSource = } +producerSource : SourceConfig m GApi.ApiProducerResult +producerSource = + { source = Endpoint (\s -> GP.send { search = s }) + <| \x -> case x of + GApi.ProducerResult e -> Just e + _ -> Nothing + , view = \i -> + [ b [ class "grayedout" ] [ text <| "p" ++ String.fromInt i.id ++ ": " ] + , text i.name ] + , key = \i -> String.fromInt i.id + } + + type alias Model a = { visible : Bool , value : String |