aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View/LoggedIn/Account.elm
diff options
context:
space:
mode:
authorJoris2016-03-27 20:20:10 +0200
committerJoris2016-03-27 20:20:10 +0200
commit702d60cbcdf85216a1b18416f4480afb77384e8a (patch)
tree400c004181373255ff0ad40ed32c69674e62ae59 /src/client/elm/View/LoggedIn/Account.elm
parent5f6c66e4c3cf02e5b1c0a1fac6036b86be06a992 (diff)
downloadbudget-702d60cbcdf85216a1b18416f4480afb77384e8a.tar.gz
budget-702d60cbcdf85216a1b18416f4480afb77384e8a.tar.bz2
budget-702d60cbcdf85216a1b18416f4480afb77384e8a.zip
Regroup loggedIn modules
Diffstat (limited to 'src/client/elm/View/LoggedIn/Account.elm')
-rw-r--r--src/client/elm/View/LoggedIn/Account.elm37
1 files changed, 19 insertions, 18 deletions
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 ]