summaryrefslogtreecommitdiff
path: root/elm/Lib/Autocomplete.elm
diff options
context:
space:
mode:
Diffstat (limited to 'elm/Lib/Autocomplete.elm')
-rw-r--r--elm/Lib/Autocomplete.elm15
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