aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View
diff options
context:
space:
mode:
authorJoris2016-06-03 20:27:16 +0200
committerJoris2016-06-03 20:27:16 +0200
commit8e3a7bf1cb83bbb6e3dcd54308eefa52a29cd679 (patch)
treed6ba0985a534a0e2e317b1edb0d4c999119d87ff /src/client/elm/View
parent3a88115d118f8256f3ff034dc359df42a9e4051c (diff)
Migrate to elm 0.17
Diffstat (limited to 'src/client/elm/View')
-rw-r--r--src/client/elm/View/Click.elm24
-rw-r--r--src/client/elm/View/Events.elm16
-rw-r--r--src/client/elm/View/Header.elm34
-rw-r--r--src/client/elm/View/Icon.elm10
-rw-r--r--src/client/elm/View/Plural.elm4
5 files changed, 30 insertions, 58 deletions
diff --git a/src/client/elm/View/Click.elm b/src/client/elm/View/Click.elm
deleted file mode 100644
index a722cac..0000000
--- a/src/client/elm/View/Click.elm
+++ /dev/null
@@ -1,24 +0,0 @@
-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/Events.elm b/src/client/elm/View/Events.elm
index c9dff9f..2802709 100644
--- a/src/client/elm/View/Events.elm
+++ b/src/client/elm/View/Events.elm
@@ -1,19 +1,17 @@
-module View.Events
+module View.Events exposing
( onSubmitPrevDefault
- ) where
+ )
-import Signal
import Json.Decode as Json
import Html exposing (..)
import Html.Events exposing (..)
import Html.Attributes exposing (..)
-onSubmitPrevDefault : Signal.Address a -> a -> Attribute
-onSubmitPrevDefault address value =
+import Msg exposing (Msg)
+
+onSubmitPrevDefault : Msg -> Attribute Msg
+onSubmitPrevDefault value =
onWithOptions
"submit"
{ defaultOptions | preventDefault = True }
- Json.value
- (\_ ->
- Signal.message address value
- )
+ (Json.succeed value)
diff --git a/src/client/elm/View/Header.elm b/src/client/elm/View/Header.elm
index 74fc2cc..5597429 100644
--- a/src/client/elm/View/Header.elm
+++ b/src/client/elm/View/Header.elm
@@ -1,13 +1,10 @@
-module View.Header
+module View.Header exposing
( renderHeader
- ) where
+ )
-import Signal exposing (Address)
import Dict
-import TransitRouter
-
-import Route exposing (..)
+import Page exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
@@ -15,32 +12,31 @@ import Html.Events exposing (..)
import Model exposing (Model)
import Model.Translations exposing (getMessage)
-import Action exposing (..)
+import Msg exposing (..)
import Model.View exposing (..)
import View.Icon exposing (renderIcon)
-import View.Click exposing (clickTo)
-renderHeader : Address Action -> Model -> Html
-renderHeader address model =
+renderHeader : Model -> Html Msg
+renderHeader model =
header
[]
( [ div [ class "title" ] [ text (getMessage "SharedCost" model.translations) ] ]
- ++ let item route name =
+ ++ let item page name =
a
- ( [ classList
- [ ("item", True)
- , ("current", TransitRouter.getRoute model == route)
- ]
- ] ++ clickTo route
- )
+ [ href (Page.toHash page)
+ , classList
+ [ ("item", True)
+ , ("current", model.page == page)
+ ]
+ ]
[ text (getMessage name model.translations)
]
in case model.view of
LoggedInView { me, users } ->
[ item Home "PaymentsTitle"
, item Income "Income"
- , item Stat "Statistics"
+ , item Statistics "Statistics"
, div
[ class "nameSignOut" ]
[ div
@@ -52,7 +48,7 @@ renderHeader address model =
]
, button
[ class "signOut item"
- , onClick address SignOut
+ , onClick SignOut
]
[ renderIcon "power-off" ]
]
diff --git a/src/client/elm/View/Icon.elm b/src/client/elm/View/Icon.elm
index 468265f..8a5e383 100644
--- a/src/client/elm/View/Icon.elm
+++ b/src/client/elm/View/Icon.elm
@@ -1,18 +1,20 @@
-module View.Icon
+module View.Icon exposing
( renderIcon
, renderSpinIcon
- ) where
+ )
import Html exposing (..)
import Html.Attributes exposing (..)
-renderIcon : String -> Html
+import Msg exposing (Msg)
+
+renderIcon : String -> Html Msg
renderIcon iconClass =
i
[ class <| "fa fa-fw fa-" ++ iconClass ]
[]
-renderSpinIcon : Html
+renderSpinIcon : Html Msg
renderSpinIcon =
i
[ class <| "fa fa-fw fa-spin fa-spinner" ]
diff --git a/src/client/elm/View/Plural.elm b/src/client/elm/View/Plural.elm
index 6e480fd..727189c 100644
--- a/src/client/elm/View/Plural.elm
+++ b/src/client/elm/View/Plural.elm
@@ -1,6 +1,6 @@
-module View.Plural
+module View.Plural exposing
( plural
- ) where
+ )
plural : Int -> String -> String -> String
plural n single multiple =