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/Paging.elm | 47 +++++++++++++++++---------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'src/client/elm/View/LoggedIn/Paging.elm') diff --git a/src/client/elm/View/LoggedIn/Paging.elm b/src/client/elm/View/LoggedIn/Paging.elm index b722ee7..20396a6 100644 --- a/src/client/elm/View/LoggedIn/Paging.elm +++ b/src/client/elm/View/LoggedIn/Paging.elm @@ -8,9 +8,10 @@ import Html exposing (..) import Html.Attributes exposing (..) import Html.Events exposing (..) +import LoggedIn.Action as LoggedInAction +import LoggedIn.Model as LoggedInModel + import Model.Action as Action exposing (..) -import Model.Action.LoggedInAction exposing (..) -import Model.View.LoggedInView exposing (..) import Model.Payment exposing (perPage) import View.Icon exposing (renderIcon) @@ -18,23 +19,23 @@ import View.Icon exposing (renderIcon) showedPages : Int showedPages = 5 -paymentsPaging : Address Action -> LoggedInView -> Html -paymentsPaging address loggedInView = - let maxPage = ceiling (toFloat loggedInView.paymentsCount / toFloat perPage) - pages = truncatePages loggedInView.currentPage [1..maxPage] +paymentsPaging : Address Action -> LoggedInModel.Model -> Html +paymentsPaging address loggedInModel = + let maxPage = ceiling (toFloat loggedInModel.paymentsCount / toFloat perPage) + pages = truncatePages loggedInModel.currentPage [1..maxPage] in if maxPage == 1 then text "" else div [ class "pages" ] - ( ( if loggedInView.currentPage > 1 - then [ firstPage address, previousPage address loggedInView ] + ( ( if loggedInModel.currentPage > 1 + then [ firstPage address, previousPage address loggedInModel ] else [] ) - ++ ( List.map (paymentsPage address loggedInView) pages) - ++ ( if loggedInView.currentPage < maxPage - then [ nextPage address loggedInView, lastPage address maxPage ] + ++ ( List.map (paymentsPage address loggedInModel) pages) + ++ ( if loggedInModel.currentPage < maxPage + then [ nextPage address loggedInModel, lastPage address maxPage ] else [] ) ) @@ -57,23 +58,23 @@ firstPage : Address Action -> Html firstPage address = button [ class "page" - , onClick address (UpdateLoggedIn (UpdatePage 1)) + , onClick address (UpdateLoggedIn (LoggedInAction.UpdatePage 1)) ] [ renderIcon "fast-backward" ] -previousPage : Address Action -> LoggedInView -> Html -previousPage address loggedInView = +previousPage : Address Action -> LoggedInModel.Model -> Html +previousPage address loggedInModel = button [ class "page" - , onClick address (UpdateLoggedIn (UpdatePage (loggedInView.currentPage - 1))) + , onClick address (UpdateLoggedIn (LoggedInAction.UpdatePage (loggedInModel.currentPage - 1))) ] [ renderIcon "backward" ] -nextPage : Address Action -> LoggedInView -> Html -nextPage address loggedInView = +nextPage : Address Action -> LoggedInModel.Model -> Html +nextPage address loggedInModel = button [ class "page" - , onClick address (UpdateLoggedIn (UpdatePage (loggedInView.currentPage + 1))) + , onClick address (UpdateLoggedIn (LoggedInAction.UpdatePage (loggedInModel.currentPage + 1))) ] [ renderIcon "forward" ] @@ -81,19 +82,19 @@ lastPage : Address Action -> Int -> Html lastPage address maxPage = button [ class "page" - , onClick address (UpdateLoggedIn (UpdatePage maxPage)) + , onClick address (UpdateLoggedIn (LoggedInAction.UpdatePage maxPage)) ] [ renderIcon "fast-forward" ] -paymentsPage : Address Action -> LoggedInView -> Int -> Html -paymentsPage address loggedInView page = - let onCurrentPage = page == loggedInView.currentPage +paymentsPage : Address Action -> LoggedInModel.Model -> Int -> Html +paymentsPage address loggedInModel page = + let onCurrentPage = page == loggedInModel.currentPage in button [ classList [ ("page", True) , ("current", onCurrentPage) ] , onClick address <| - if onCurrentPage then Action.NoOp else UpdateLoggedIn (UpdatePage page) + if onCurrentPage then Action.NoOp else UpdateLoggedIn (LoggedInAction.UpdatePage page) ] [ text (toString page) ] -- cgit v1.2.3