From e32a9126ae7fd7f9596dd08b64ecab8644d994bd Mon Sep 17 00:00:00 2001 From: Joris Date: Wed, 30 Dec 2015 00:28:41 +0100 Subject: Upgrade to elm 0.16.0 --- src/client/elm/Model/Payer.elm | 4 +-- src/client/elm/Model/Translations.elm | 2 +- src/client/elm/Model/View/LoggedIn/Account.elm | 2 +- src/client/elm/Update.elm | 14 +++++------ src/client/elm/Update/LoggedIn.elm | 34 +++++++++++++------------- src/client/elm/Update/LoggedIn/Account.elm | 16 ++++++------ src/client/elm/Update/LoggedIn/Add.elm | 10 ++++---- src/client/elm/Update/LoggedIn/Monthly.elm | 8 +++--- src/client/elm/Update/SignIn.elm | 2 +- src/client/elm/View/Events.elm | 2 +- src/client/elm/View/LoggedIn/Paging.elm | 12 ++++----- 11 files changed, 53 insertions(+), 53 deletions(-) (limited to 'src/client/elm') diff --git a/src/client/elm/Model/Payer.elm b/src/client/elm/Model/Payer.elm index 9fd1bb5..f39a612 100644 --- a/src/client/elm/Model/Payer.elm +++ b/src/client/elm/Model/Payer.elm @@ -51,9 +51,9 @@ updatePayers payers userId creation amountDiff = |> Maybe.withDefault False in if postIncome then - Just { payer | postIncomePaymentSum <- payer.postIncomePaymentSum + amountDiff } + Just { payer | postIncomePaymentSum = payer.postIncomePaymentSum + amountDiff } else - Just { payer | preIncomePaymentSum <- payer.preIncomePaymentSum + amountDiff } + Just { payer | preIncomePaymentSum = payer.preIncomePaymentSum + amountDiff } Nothing -> Nothing ) diff --git a/src/client/elm/Model/Translations.elm b/src/client/elm/Model/Translations.elm index bec8c9b..dbf378c 100644 --- a/src/client/elm/Model/Translations.elm +++ b/src/client/elm/Model/Translations.elm @@ -45,7 +45,7 @@ partDecoderWithTag : String -> Json.Decoder MessagePart partDecoderWithTag tag = case tag of "Order" -> Json.object1 Order ("contents" := Json.int) - "Str" -> Json.object1 Str ("contents" := Json.string) + _ -> Json.object1 Str ("contents" := Json.string) ----- diff --git a/src/client/elm/Model/View/LoggedIn/Account.elm b/src/client/elm/Model/View/LoggedIn/Account.elm index 2bb3ae7..4638c8d 100644 --- a/src/client/elm/Model/View/LoggedIn/Account.elm +++ b/src/client/elm/Model/View/LoggedIn/Account.elm @@ -31,7 +31,7 @@ initAccount me payers = payers |> mapValues (\payer -> - { payer | incomes <- List.sortBy .creation payer.incomes } + { payer | incomes = List.sortBy .creation payer.incomes } ) , visibleDetail = False , incomeEdition = Nothing diff --git a/src/client/elm/Update.elm b/src/client/elm/Update.elm index 3c4614a..ed4b99d 100644 --- a/src/client/elm/Update.elm +++ b/src/client/elm/Update.elm @@ -35,23 +35,23 @@ updateModel action model = NoOp -> model UpdateTime time -> - { model | currentTime <- time } + { model | currentTime = time } GoSignInView -> - { model | view <- V.SignInView initSignInView } + { model | view = V.SignInView initSignInView } GoLoggedInView users me monthlyPayments payments paymentsCount payers -> - { model | view <- V.LoggedInView (initLoggedInView users me monthlyPayments payments paymentsCount payers) } + { model | view = V.LoggedInView (initLoggedInView users me monthlyPayments payments paymentsCount payers) } SignInError msg -> - let signInView = { initSignInView | result <- Just (Err msg) } - in { model | view <- V.SignInView signInView } + let signInView = { initSignInView | result = Just (Err msg) } + in { model | view = V.SignInView signInView } UpdateSignIn signInAction -> case model.view of V.SignInView signInView -> - { model | view <- V.SignInView (updateSignIn signInAction signInView) } + { model | view = V.SignInView (updateSignIn signInAction signInView) } _ -> model UpdateLoggedIn loggedAction -> case model.view of V.LoggedInView loggedInView -> - { model | view <- V.LoggedInView (updateLoggedIn model loggedAction loggedInView) } + { model | view = V.LoggedInView (updateLoggedIn model loggedAction loggedInView) } _ -> model diff --git a/src/client/elm/Update/LoggedIn.elm b/src/client/elm/Update/LoggedIn.elm index e477094..5292c25 100644 --- a/src/client/elm/Update/LoggedIn.elm +++ b/src/client/elm/Update/LoggedIn.elm @@ -31,38 +31,38 @@ updateLoggedIn : Model -> LoggedAction -> LoggedInView -> LoggedInView updateLoggedIn model action loggedInView = case action of UpdateAdd addPaymentAction -> - { loggedInView | add <- updateAddPayment addPaymentAction loggedInView.add } + { loggedInView | add = updateAddPayment addPaymentAction loggedInView.add } UpdatePayments payments -> - { loggedInView | payments <- payments } + { loggedInView | payments = payments } AddPayment userId name cost payments -> { loggedInView - | payments <- payments - , currentPage <- 1 - , add <- initAddPayment Punctual - , account <- UA.updateAccount (UA.UpdatePayer userId model.currentTime cost) loggedInView.account - , paymentsCount <- loggedInView.paymentsCount + 1 + | payments = payments + , currentPage = 1 + , add = initAddPayment Punctual + , account = UA.updateAccount (UA.UpdatePayer userId model.currentTime cost) loggedInView.account + , paymentsCount = loggedInView.paymentsCount + 1 } AddMonthlyPayment id name cost -> { loggedInView - | add <- initAddPayment Monthly - , monthly <- + | add = initAddPayment Monthly + , monthly = let payment = Payment id (Date.fromTime model.currentTime) name cost loggedInView.account.me in UM.updateMonthly (UM.AddPayment payment) loggedInView.monthly } ToggleEdit id -> - { loggedInView | paymentEdition <- if loggedInView.paymentEdition == Just id then Nothing else Just id } + { loggedInView | paymentEdition = if loggedInView.paymentEdition == Just id then Nothing else Just id } DeletePayment payment payments -> { loggedInView - | payments <- payments - , account <- UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account - , paymentsCount <- loggedInView.paymentsCount - 1 + | payments = payments + , account = UA.updateAccount (UA.UpdatePayer payment.userId (Date.toTime payment.creation) -payment.cost) loggedInView.account + , paymentsCount = loggedInView.paymentsCount - 1 } UpdatePage page payments -> { loggedInView - | currentPage <- page - , payments <- payments + | currentPage = page + , payments = payments } UpdateMonthly monthlyAction -> - { loggedInView | monthly <- UM.updateMonthly monthlyAction loggedInView.monthly } + { loggedInView | monthly = UM.updateMonthly monthlyAction loggedInView.monthly } UpdateAccount accountAction -> - { loggedInView | account <- UA.updateAccount accountAction loggedInView.account } + { loggedInView | account = UA.updateAccount accountAction loggedInView.account } diff --git a/src/client/elm/Update/LoggedIn/Account.elm b/src/client/elm/Update/LoggedIn/Account.elm index cf4c834..c7a66dd 100644 --- a/src/client/elm/Update/LoggedIn/Account.elm +++ b/src/client/elm/Update/LoggedIn/Account.elm @@ -25,11 +25,11 @@ updateAccount : AccountAction -> Account -> Account updateAccount action account = case action of ToggleDetail -> - { account | visibleDetail <- not account.visibleDetail } + { account | visibleDetail = not account.visibleDetail } UpdatePayer userId creation amountDiff -> - { account | payers <- updatePayers account.payers userId creation amountDiff } + { account | payers = updatePayers account.payers userId creation amountDiff } ToggleIncomeEdition -> - { account | incomeEdition <- + { account | incomeEdition = if isJust account.incomeEdition then Nothing else Just (initIncomeEdition (Maybe.withDefault 0 (getCurrentIncome account))) @@ -37,28 +37,28 @@ updateAccount action account = UpdateIncomeEdition income -> case account.incomeEdition of Just incomeEdition -> - { account | incomeEdition <- Just { incomeEdition | income <- income } } + { account | incomeEdition = Just { incomeEdition | income = income } } Nothing -> account UpdateEditionError error -> case account.incomeEdition of Just incomeEdition -> - { account | incomeEdition <- Just { incomeEdition | error <- Just error } } + { account | incomeEdition = Just { incomeEdition | error = Just error } } Nothing -> account UpdateIncome currentTime amount -> { account - | payers <- + | payers = account.payers |> Dict.update account.me (\mbPayer -> case mbPayer of Just payer -> Just { payer - | incomes <- payer.incomes ++ [{ creation = currentTime, amount = amount }] + | incomes = payer.incomes ++ [{ creation = currentTime, amount = amount }] } Nothing -> Nothing ) - , incomeEdition <- Nothing + , incomeEdition = Nothing } diff --git a/src/client/elm/Update/LoggedIn/Add.elm b/src/client/elm/Update/LoggedIn/Add.elm index 1f28997..92bdb7e 100644 --- a/src/client/elm/Update/LoggedIn/Add.elm +++ b/src/client/elm/Update/LoggedIn/Add.elm @@ -15,15 +15,15 @@ updateAddPayment : AddPaymentAction -> AddPayment -> AddPayment updateAddPayment action addPayment = case action of UpdateName name -> - { addPayment | name <- name } + { addPayment | name = name } UpdateCost cost -> - { addPayment | cost <- cost } + { addPayment | cost = cost } AddError nameError costError -> { addPayment - | nameError <- nameError - , costError <- costError + | nameError = nameError + , costError = costError } ToggleFrequency -> { addPayment - | frequency <- if addPayment.frequency == Punctual then Monthly else Punctual + | frequency = if addPayment.frequency == Punctual then Monthly else Punctual } diff --git a/src/client/elm/Update/LoggedIn/Monthly.elm b/src/client/elm/Update/LoggedIn/Monthly.elm index 1379323..275b3e8 100644 --- a/src/client/elm/Update/LoggedIn/Monthly.elm +++ b/src/client/elm/Update/LoggedIn/Monthly.elm @@ -15,13 +15,13 @@ updateMonthly : MonthlyAction -> Monthly -> Monthly updateMonthly action monthly = case action of ToggleDetail -> - { monthly | visibleDetail <- not monthly.visibleDetail } + { monthly | visibleDetail = not monthly.visibleDetail } AddPayment payment -> { monthly - | payments <- payment :: monthly.payments - , visibleDetail <- True + | payments = payment :: monthly.payments + , visibleDetail = True } DeletePayment id -> { monthly - | payments <- List.filter (\payment -> payment.id /= id) monthly.payments + | payments = List.filter (\payment -> payment.id /= id) monthly.payments } diff --git a/src/client/elm/Update/SignIn.elm b/src/client/elm/Update/SignIn.elm index cabe4cb..961fb16 100644 --- a/src/client/elm/Update/SignIn.elm +++ b/src/client/elm/Update/SignIn.elm @@ -12,4 +12,4 @@ updateSignIn : SignInAction -> SignInView -> SignInView updateSignIn action signInView = case action of ErrorLogin message -> - { signInView | result <- Just (Err message) } + { signInView | result = Just (Err message) } diff --git a/src/client/elm/View/Events.elm b/src/client/elm/View/Events.elm index 1eb9027..c9dff9f 100644 --- a/src/client/elm/View/Events.elm +++ b/src/client/elm/View/Events.elm @@ -12,7 +12,7 @@ onSubmitPrevDefault : Signal.Address a -> a -> Attribute onSubmitPrevDefault address value = onWithOptions "submit" - { defaultOptions | preventDefault <- True } + { defaultOptions | preventDefault = True } Json.value (\_ -> Signal.message address value diff --git a/src/client/elm/View/LoggedIn/Paging.elm b/src/client/elm/View/LoggedIn/Paging.elm index 93d7f1d..608113b 100644 --- a/src/client/elm/View/LoggedIn/Paging.elm +++ b/src/client/elm/View/LoggedIn/Paging.elm @@ -46,12 +46,12 @@ truncatePages currentPage pages = showedLeftPages = ceiling ((toFloat showedPages - 1) / 2) showedRightPages = floor ((toFloat showedPages - 1) / 2) truncatedPages = - if | currentPage < showedLeftPages -> - [1..showedPages] - | currentPage > totalPages - showedRightPages -> - [(totalPages - showedPages)..totalPages] - | otherwise -> - [(currentPage - showedLeftPages)..(currentPage + showedRightPages)] + if currentPage < showedLeftPages then + [1..showedPages] + else if currentPage > totalPages - showedRightPages then + [(totalPages - showedPages)..totalPages] + else + [(currentPage - showedLeftPages)..(currentPage + showedRightPages)] in List.filter (flip List.member pages) truncatedPages firstPage : Html -- cgit v1.2.3