aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/View')
-rw-r--r--src/client/elm/View/Click.elm24
-rw-r--r--src/client/elm/View/Header.elm15
2 files changed, 33 insertions, 6 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)
+ ]
diff --git a/src/client/elm/View/Header.elm b/src/client/elm/View/Header.elm
index f1b0e76..5a37d9b 100644
--- a/src/client/elm/View/Header.elm
+++ b/src/client/elm/View/Header.elm
@@ -5,6 +5,8 @@ module View.Header
import Signal exposing (Address)
import Dict
+import Route exposing (..)
+
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
@@ -15,24 +17,25 @@ import Action exposing (..)
import Model.View exposing (..)
import View.Icon exposing (renderIcon)
+import View.Click exposing (clickTo)
renderHeader : Address Action -> Model -> Html
renderHeader address model =
header
[]
- [ button
- [ class "title" ]
+ [ a
+ ( [ class "title" ] ++ clickTo Home)
[ h1
[]
[ text (getMessage "SharedCost" model.translations) ]
]
, case model.view of
- LoggedInView { users, account } ->
+ LoggedInView { home } ->
div
[ class "signedPanel" ]
- [ button
- [ class "user" ]
- [ Dict.get account.me users
+ [ a
+ ( [ class "user" ] ++ clickTo User)
+ [ Dict.get home.account.me home.users
|> Maybe.map .name
|> Maybe.withDefault ""
|> text