From 702d60cbcdf85216a1b18416f4480afb77384e8a Mon Sep 17 00:00:00 2001 From: Joris Date: Sun, 27 Mar 2016 20:20:10 +0200 Subject: Regroup loggedIn modules --- src/client/elm/View/LoggedIn/AddPayment.elm | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/client/elm/View/LoggedIn/AddPayment.elm') diff --git a/src/client/elm/View/LoggedIn/AddPayment.elm b/src/client/elm/View/LoggedIn/AddPayment.elm index 7c0d34b..010ecd3 100644 --- a/src/client/elm/View/LoggedIn/AddPayment.elm +++ b/src/client/elm/View/LoggedIn/AddPayment.elm @@ -9,15 +9,16 @@ import Html as H exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) +import LoggedIn.Action as LoggedInAction +import LoggedIn.Model as LoggedInModel + import Model exposing (Model) import Model.Payment exposing (PaymentFrequency(..)) import Model.Translations exposing (getMessage) import Model.Action as Action exposing (..) -import Model.Action.LoggedInAction as LoggedInAction exposing (..) import Model.Action.AddPaymentAction exposing (..) import Model.View.LoggedIn.AddPayment exposing (..) -import Model.View.LoggedInView exposing (LoggedInView) import View.Events exposing (onSubmitPrevDefault) import View.Icon exposing (..) @@ -25,30 +26,30 @@ import View.Icon exposing (..) import Utils.Maybe exposing (isJust) import Utils.Either exposing (toMaybeError) -addPayment : Address Action -> Model -> LoggedInView -> Html -addPayment address model loggedInView = +addPayment : Address Action -> Model -> LoggedInModel.Model -> Html +addPayment address model loggedInModel = H.form [ let update = - if loggedInView.add.waitingServer + if loggedInModel.add.waitingServer then Action.NoOp else - UpdateLoggedIn <| LoggedInAction.AddPayment loggedInView.add.name loggedInView.add.cost loggedInView.add.frequency + UpdateLoggedIn <| LoggedInAction.AddPayment loggedInModel.add.name loggedInModel.add.cost loggedInModel.add.frequency in onSubmitPrevDefault address update , class "addPayment" ] - [ addPaymentName address loggedInView.add - , addPaymentCost address model loggedInView.add - , paymentFrequency address model loggedInView.add + [ addPaymentName address loggedInModel.add + , addPaymentCost address model loggedInModel.add + , paymentFrequency address model loggedInModel.add , button [ type' "submit" , classList [ ("add", True) - , ("waitingServer", loggedInView.add.waitingServer) + , ("waitingServer", loggedInModel.add.waitingServer) ] ] [ text (getMessage "Add" model.translations) - , if loggedInView.add.waitingServer then renderSpinIcon else text "" + , if loggedInModel.add.waitingServer then renderSpinIcon else text "" ] ] @@ -63,7 +64,7 @@ addPaymentName address addPayment = [ input [ id "nameInput" , value addPayment.name - , on "input" targetValue (Signal.message address << UpdateLoggedIn << UpdateAdd << UpdateName) + , on "input" targetValue (Signal.message address << UpdateLoggedIn << LoggedInAction.UpdateAdd << UpdateName) , maxlength 20 ] [] @@ -88,7 +89,7 @@ addPaymentCost address model addPayment = [ input [ id "costInput" , value addPayment.cost - , on "input" targetValue (Signal.message address << UpdateLoggedIn << UpdateAdd << UpdateCost) + , on "input" targetValue (Signal.message address << UpdateLoggedIn << LoggedInAction.UpdateAdd << UpdateCost) , maxlength 7 ] [] @@ -107,7 +108,7 @@ paymentFrequency address model addPayment = button [ type' "button" , class "frequency" - , onClick address (UpdateLoggedIn << UpdateAdd <| ToggleFrequency) + , onClick address (UpdateLoggedIn << LoggedInAction.UpdateAdd <| ToggleFrequency) ] [ div [ classList -- cgit v1.2.3