diff options
author | Joris Guyonvarch | 2015-05-10 13:06:08 +0200 |
---|---|---|
committer | Joris Guyonvarch | 2015-05-10 13:06:08 +0200 |
commit | 1f06679a739ba0be3b6b91c10bfd762a06c9573a (patch) | |
tree | 060353b47ddb4e2ad1f366015d70a0d712149c23 /src/View | |
parent | cf26834c717043685866b47eb95bcd8d1299a78b (diff) |
Migrationg to Elm 0.15
Diffstat (limited to 'src/View')
-rw-r--r-- | src/View/ActivatedClasses.elm | 2 | ||||
-rw-r--r-- | src/View/Timer.elm | 49 | ||||
-rw-r--r-- | src/View/View.elm | 20 |
3 files changed, 35 insertions, 36 deletions
diff --git a/src/View/ActivatedClasses.elm b/src/View/ActivatedClasses.elm index 9594448..85b0841 100644 --- a/src/View/ActivatedClasses.elm +++ b/src/View/ActivatedClasses.elm @@ -3,7 +3,7 @@ module View.ActivatedClasses ) where import Html -import Html.Attributes (..) +import Html.Attributes exposing (..) import List import String diff --git a/src/View/Timer.elm b/src/View/Timer.elm index a88f9dd..c4b3bbb 100644 --- a/src/View/Timer.elm +++ b/src/View/Timer.elm @@ -2,29 +2,29 @@ module View.Timer ( timerView ) where -import Html (..) -import Html.Attributes (..) -import Html.Events (..) -import Time (Time) +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) +import Time exposing (Time) import Signal import Maybe import List import String -import Model.Model (..) -import Model.Timer (..) -import Model.Edition.Edition (..) -import Model.Edition.NameEdition (..) -import Model.Edition.TimeEdition (..) -import Model.TimerState (..) -import Model.Id (..) +import Model.Model exposing (..) +import Model.Timer exposing (..) +import Model.Edition.Edition exposing (..) +import Model.Edition.NameEdition exposing (..) +import Model.Edition.TimeEdition exposing (..) +import Model.TimerState exposing (..) +import Model.Id exposing (..) -import Update.Update (..) -import Update.UpdateTimer (..) +import Update.Update exposing (..) +import Update.UpdateTimer exposing (..) -import View.ActivatedClasses (..) +import View.ActivatedClasses exposing (..) -import Utils.Maybe (..) +import Utils.Maybe exposing (..) timerView : Model -> (Id, Timer) -> Html timerView model (id, timer) = @@ -41,7 +41,7 @@ nameBlockReadOnly : Id -> Timer -> Html nameBlockReadOnly id timer = div [ class "name block" - , onClick (Signal.send updates (Edit id Name)) + , onClick actions.address (Edit id Name) ] [ text (timerName id timer) ] @@ -52,7 +52,7 @@ nameBlockEdition id timer edition = , (isEmpty edition, "empty") ] |> activatedClasses - , onClick (Signal.send updates NoOp) + , onClick actions.address NoOp ] [ if isEmpty edition then @@ -75,10 +75,9 @@ timeBlockReadOnly id timer = , (timer.state == Running, "isRunning") ] |> activatedClasses - , onClick - <| if timer.state == Ringing - then Signal.send updates (UpdateTimer id Stop) - else Signal.send updates (Edit id Time) + , if timer.state == Ringing + then onClick actions.address (UpdateTimer id Stop) + else onClick actions.address (Edit id Time) ] [ timeWithProgressBar timer ] @@ -89,7 +88,7 @@ timeBlockEdition timer edition = , (isEmpty edition, "empty") ] |> activatedClasses - , onClick (Signal.send updates NoOp) + , onClick actions.address NoOp ] [ if isEmpty edition then @@ -134,7 +133,7 @@ playPauseBlock : (Id, Timer) -> Html playPauseBlock (id, timer) = button [ class <| "playPause block" - , onClick (Signal.send updates (UpdateTimer id ToggleRunning)) + , onClick actions.address (UpdateTimer id ToggleRunning) ] [ let icon = if timer.state == Running then "fa-pause" else "fa-play" in i @@ -146,7 +145,7 @@ stopBlock : (Id, Timer) -> Html stopBlock (id, timer) = button [ class <| "stop block" - , onClick (Signal.send updates (UpdateTimer id Stop)) + , onClick actions.address (UpdateTimer id Stop) ] [ i [ class "fa fa-fw fa-stop" ] [] ] @@ -154,7 +153,7 @@ removeBlock : (Id, Timer) -> Html removeBlock (id, timer) = button [ class <| "remove block" - , onClick (Signal.send updates (RemoveTimer id)) + , onClick actions.address (RemoveTimer id) ] [ i [ class "fa fa-fw fa-remove" ] [] ] diff --git a/src/View/View.elm b/src/View/View.elm index 0500610..b3d1dcc 100644 --- a/src/View/View.elm +++ b/src/View/View.elm @@ -2,21 +2,21 @@ module View.View ( view ) where -import Html (..) -import Html.Attributes (..) -import Html.Events (..) +import Html exposing (..) +import Html.Attributes exposing (..) +import Html.Events exposing (..) import Signal import List import Dict import Json.Decode as Json -import Model.Model (..) -import Model.Timer (..) -import Model.Id (..) +import Model.Model exposing (..) +import Model.Timer exposing (..) +import Model.Id exposing (..) -import Update.Update (..) +import Update.Update exposing (..) -import View.Timer (timerView) +import View.Timer exposing (timerView) view : Model -> Html view model = @@ -35,12 +35,12 @@ title = div [ class "headerBar" ] [ button - [ onClick (Signal.send updates Initialize) + [ onClick actions.address Initialize , class "title" ] [ text "Timer" ] , button - [ onClick (Signal.send updates AddNewTimer) + [ onClick actions.address AddNewTimer , class "addTimer" ] [ i |