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/Account.elm | 37 ++++++++++++++++---------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'src/client/elm/View/LoggedIn/Account.elm') diff --git a/src/client/elm/View/LoggedIn/Account.elm b/src/client/elm/View/LoggedIn/Account.elm index 5bbf73e..66d8582 100644 --- a/src/client/elm/View/LoggedIn/Account.elm +++ b/src/client/elm/View/LoggedIn/Account.elm @@ -10,15 +10,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.User exposing (getUserName) import Model.Payer exposing (..) import Model.Translations exposing (getParamMessage, getMessage) import Model.Action exposing (..) -import Model.Action.LoggedInAction exposing (..) import Model.Action.AccountAction exposing (..) -import Model.View.LoggedInView exposing (LoggedInView) import Model.View.LoggedIn.Account exposing (..) import View.Expand exposing (..) @@ -27,39 +28,39 @@ import View.Events exposing (onSubmitPrevDefault) import Utils.Either exposing (toMaybeError) -account : Address Action -> Model -> LoggedInView -> Html -account address model loggedInView = - let account = loggedInView.account +account : Address Action -> Model -> LoggedInModel.Model -> Html +account address model loggedInModel = + let account = loggedInModel.account in div [ classList [ ("account", True) , ("detail", account.visibleDetail) ] ] - [ exceedingPayers address model loggedInView + [ exceedingPayers address model loggedInModel , if account.visibleDetail then income address model account else text "" ] -exceedingPayers : Address Action -> Model -> LoggedInView -> Html -exceedingPayers address model loggedInView = +exceedingPayers : Address Action -> Model -> LoggedInModel.Model -> Html +exceedingPayers address model loggedInModel = button [ class "header" - , onClick address (UpdateLoggedIn << UpdateAccount <| ToggleDetail) + , onClick address (UpdateLoggedIn << LoggedInAction.UpdateAccount <| ToggleDetail) ] - ( (List.map (exceedingPayer model loggedInView) (getOrderedExceedingPayers model.currentTime loggedInView.users loggedInView.account.incomes loggedInView.payments)) - ++ [ expand ExpandDown loggedInView.account.visibleDetail ] + ( (List.map (exceedingPayer model loggedInModel) (getOrderedExceedingPayers model.currentTime loggedInModel.users loggedInModel.account.incomes loggedInModel.payments)) + ++ [ expand ExpandDown loggedInModel.account.visibleDetail ] ) -exceedingPayer : Model -> LoggedInView -> ExceedingPayer -> Html -exceedingPayer model loggedInView payer = +exceedingPayer : Model -> LoggedInModel.Model -> ExceedingPayer -> Html +exceedingPayer model loggedInModel payer = div [ class "exceedingPayer" ] [ span [ class "userName" ] [ payer.userId - |> getUserName loggedInView.users + |> getUserName loggedInModel.users |> Maybe.withDefault "−" |> text ] @@ -94,9 +95,9 @@ incomeEdition address model account edition = H.form [ case validateIncome edition.income model.translations of Ok validatedAmount -> - onSubmitPrevDefault address (UpdateLoggedIn << UpdateAccount <| UpdateIncome model.currentTime validatedAmount) + onSubmitPrevDefault address (UpdateLoggedIn << LoggedInAction.UpdateAccount <| UpdateIncome model.currentTime validatedAmount) Err error -> - onSubmitPrevDefault address (UpdateLoggedIn << UpdateAccount << UpdateEditionError <| error) + onSubmitPrevDefault address (UpdateLoggedIn << LoggedInAction.UpdateAccount << UpdateEditionError <| error) , class "income" ] [ label @@ -105,7 +106,7 @@ incomeEdition address model account edition = , input [ id "incomeInput" , value edition.income - , on "input" targetValue (Signal.message address << UpdateLoggedIn << UpdateAccount << UpdateIncomeEdition) + , on "input" targetValue (Signal.message address << UpdateLoggedIn << LoggedInAction.UpdateAccount << UpdateIncomeEdition) , maxlength 10 ] [] @@ -125,6 +126,6 @@ toggleIncomeEdition address className name = button [ type' "button" , class className - , onClick address (UpdateLoggedIn << UpdateAccount <| ToggleIncomeEdition) + , onClick address (UpdateLoggedIn << LoggedInAction.UpdateAccount <| ToggleIncomeEdition) ] [ text name ] -- cgit v1.2.3