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/Monthly.elm | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'src/client/elm/View/LoggedIn/Monthly.elm') diff --git a/src/client/elm/View/LoggedIn/Monthly.elm b/src/client/elm/View/LoggedIn/Monthly.elm index 2e9ff1e..ae7e6bc 100644 --- a/src/client/elm/View/LoggedIn/Monthly.elm +++ b/src/client/elm/View/LoggedIn/Monthly.elm @@ -9,22 +9,23 @@ import Html 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 as Payment exposing (Payments, Payment) import Model.Translations exposing (getMessage, getParamMessage) import Model.Action exposing (..) -import Model.Action.LoggedInAction as LoggedInAction exposing (..) import Model.Action.MonthlyAction exposing (..) import Model.View.LoggedIn.Monthly exposing (Monthly) -import Model.View.LoggedInView exposing (LoggedInView) import View.Icon exposing (renderIcon) import View.Expand exposing (..) import View.Price exposing (price) -monthlyPayments : Address Action -> Model -> LoggedInView -> Html -monthlyPayments address model loggedInView = - let monthly = loggedInView.monthly +monthlyPayments : Address Action -> Model -> LoggedInModel.Model -> Html +monthlyPayments address model loggedInModel = + let monthly = loggedInModel.monthly in if List.length monthly.payments == 0 then text "" @@ -36,7 +37,7 @@ monthlyPayments address model loggedInView = ] ] [ monthlyCount address model monthly - , if monthly.visibleDetail then paymentsTable address model loggedInView monthly else text "" + , if monthly.visibleDetail then paymentsTable address model loggedInModel monthly else text "" ] monthlyCount : Address Action -> Model -> Monthly -> Html @@ -46,29 +47,29 @@ monthlyCount address model monthly = key = if count > 1 then "PluralMonthlyCount" else "SingularMonthlyCount" in button [ class "header" - , onClick address (UpdateLoggedIn << UpdateMonthly <| ToggleDetail) + , onClick address (UpdateLoggedIn << LoggedInAction.UpdateMonthly <| ToggleDetail) ] [ text (getParamMessage [toString count, price model total] key model.translations) , expand ExpandDown monthly.visibleDetail ] -paymentsTable : Address Action -> Model -> LoggedInView -> Monthly -> Html -paymentsTable address model loggedInView monthly = +paymentsTable : Address Action -> Model -> LoggedInModel.Model -> Monthly -> Html +paymentsTable address model loggedInModel monthly = div [ class "table" ] ( monthly.payments |> List.sortBy (String.toLower << .name) - |> List.map (paymentLine address model loggedInView) + |> List.map (paymentLine address model loggedInModel) ) -paymentLine : Address Action -> Model -> LoggedInView -> Payment -> Html -paymentLine address model loggedInView payment = +paymentLine : Address Action -> Model -> LoggedInModel.Model -> Payment -> Html +paymentLine address model loggedInModel payment = a [ classList [ ("row", True) - , ("edition", loggedInView.paymentEdition == Just payment.id) + , ("edition", loggedInModel.paymentEdition == Just payment.id) ] - , onClick address (UpdateLoggedIn (ToggleEdit payment.id)) + , onClick address (UpdateLoggedIn (LoggedInAction.ToggleEdit payment.id)) ] [ div [ class "cell category" ] [ text (payment.name) ] , div -- cgit v1.2.3