diff options
Diffstat (limited to 'src/client/elm/View/Click.elm')
-rw-r--r-- | src/client/elm/View/Click.elm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/client/elm/View/Click.elm b/src/client/elm/View/Click.elm new file mode 100644 index 0000000..a722cac --- /dev/null +++ b/src/client/elm/View/Click.elm @@ -0,0 +1,24 @@ +module View.Click + ( clickTo + ) where + +import Signal +import Json.Decode as Json + +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) + +import TransitRouter +import Route exposing (Route, toPath) + +clickTo : Route -> List Attribute +clickTo route = + let path = toPath route + in [ href path + , onWithOptions + "click" + { stopPropagation = True, preventDefault = True } + Json.value + (\_ -> Signal.message TransitRouter.pushPathAddress path) + ] |