diff options
author | Joris Guyonvarch | 2015-03-21 12:33:58 +0100 |
---|---|---|
committer | Joris Guyonvarch | 2015-03-21 12:33:58 +0100 |
commit | 9e6cf2f2f15b3fef1f99a2fcf980eb96945dc936 (patch) | |
tree | 3e460acb675bf1511baaaa603d1478f6464bba8a /src/View/Timer.elm | |
parent | 11403e9e7a07494d72df0b225216c15724386aa8 (diff) |
Cannot delete a timer if it is the last one
Diffstat (limited to 'src/View/Timer.elm')
-rw-r--r-- | src/View/Timer.elm | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/View/Timer.elm b/src/View/Timer.elm index 2325d3a..9c302a4 100644 --- a/src/View/Timer.elm +++ b/src/View/Timer.elm @@ -37,7 +37,7 @@ timerView model (id, timer) = , restartBlock (id, timer) , playPauseBlock (id, timer) , stopBlock (id, timer) - , removeBlock (id, timer) + , removeBlock model (id, timer) ] nameBlock : (Id, Timer) -> Html @@ -105,13 +105,17 @@ stopBlock (id, timer) = ] [ i [ class "fa fa-fw fa-stop" ] [] ] -removeBlock : (Id, Timer) -> Html -removeBlock (id, timer) = - button - [ class <| "remove block" - , onClick (Signal.send updates (RemoveTimer id)) - ] - [ i [ class "fa fa-fw fa-remove" ] [] ] +removeBlock : Model -> (Id, Timer) -> Html +removeBlock model (id, timer) = + let removeClass = + if numberOfTimers model > 1 + then "remove" + else "singleRemove" + in button + [ class <| "block " ++ removeClass + , onClick (Signal.send updates (RemoveTimer id)) + ] + [ i [ class "fa fa-fw fa-remove" ] [] ] stopIfRinging : (Id, Timer) -> Signal.Message -> Signal.Message stopIfRinging (id, timer) message = |