aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View/Click.elm
blob: a722cacb6610df35e5fb9a65f1ab60863f30b0d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
      ]