diff options
author | Joris | 2016-03-28 17:51:14 +0200 |
---|---|---|
committer | Joris | 2016-03-28 17:51:14 +0200 |
commit | 166cd04e4b28770ede854dafc9ae30eae64102fe (patch) | |
tree | 2245a31243a165acc6f7355534da44cfd17e6038 /src/client/elm/View | |
parent | b0d80a5458d7ba4546e5f01f5b6398ea6d23f981 (diff) |
Create an empty but reachable user page
Diffstat (limited to 'src/client/elm/View')
-rw-r--r-- | src/client/elm/View/Click.elm | 24 | ||||
-rw-r--r-- | src/client/elm/View/Header.elm | 15 |
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 |