From b73ba24f3440b81698c9d5c370739d03f958f059 Mon Sep 17 00:00:00 2001 From: Joris Date: Thu, 31 Dec 2015 19:34:29 +0100 Subject: Fetch all the payments, do the paging only in the UI --- src/client/elm/View/LoggedIn/Paging.elm | 14 ++++++-------- src/client/elm/View/LoggedIn/Table.elm | 2 ++ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src/client/elm/View/LoggedIn') diff --git a/src/client/elm/View/LoggedIn/Paging.elm b/src/client/elm/View/LoggedIn/Paging.elm index 608113b..e40c5aa 100644 --- a/src/client/elm/View/LoggedIn/Paging.elm +++ b/src/client/elm/View/LoggedIn/Paging.elm @@ -9,8 +9,6 @@ import Html.Events exposing (..) import Model.View.LoggedInView exposing (..) import Model.Payment exposing (perPage) -import ServerCommunication as SC exposing (serverCommunications) - import Update exposing (..) import Update.LoggedIn exposing (..) @@ -58,7 +56,7 @@ firstPage : Html firstPage = button [ class "page" - , onClick serverCommunications.address (SC.UpdatePage 1) + , onClick actions.address (UpdateLoggedIn (UpdatePage 1)) ] [ renderIcon "fast-backward" ] @@ -66,7 +64,7 @@ previousPage : LoggedInView -> Html previousPage loggedInView = button [ class "page" - , onClick serverCommunications.address (SC.UpdatePage (loggedInView.currentPage - 1)) + , onClick actions.address (UpdateLoggedIn (UpdatePage (loggedInView.currentPage - 1))) ] [ renderIcon "backward" ] @@ -74,7 +72,7 @@ nextPage : LoggedInView -> Html nextPage loggedInView = button [ class "page" - , onClick serverCommunications.address (SC.UpdatePage (loggedInView.currentPage + 1)) + , onClick actions.address (UpdateLoggedIn (UpdatePage (loggedInView.currentPage + 1))) ] [ renderIcon "forward" ] @@ -82,7 +80,7 @@ lastPage : Int -> Html lastPage maxPage = button [ class "page" - , onClick serverCommunications.address (SC.UpdatePage maxPage) + , onClick actions.address (UpdateLoggedIn (UpdatePage maxPage)) ] [ renderIcon "fast-forward" ] @@ -94,7 +92,7 @@ paymentsPage loggedInView page = [ ("page", True) , ("current", onCurrentPage) ] - , onClick serverCommunications.address <| - if onCurrentPage then SC.NoCommunication else SC.UpdatePage page + , onClick actions.address <| + if onCurrentPage then NoOp else UpdateLoggedIn (UpdatePage page) ] [ text (toString page) ] diff --git a/src/client/elm/View/LoggedIn/Table.elm b/src/client/elm/View/LoggedIn/Table.elm index f5a08b5..51a7b73 100644 --- a/src/client/elm/View/LoggedIn/Table.elm +++ b/src/client/elm/View/LoggedIn/Table.elm @@ -49,6 +49,8 @@ paymentLines model loggedInView = loggedInView.payments |> List.sortBy (Date.toTime << .creation) |> List.reverse + |> List.drop ((loggedInView.currentPage - 1) * perPage) + |> List.take perPage |> List.map (paymentLine model loggedInView) paymentLine : Model -> LoggedInView -> Payment -> Html -- cgit v1.2.3