aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View/LoggedIn/Paging.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/Paging.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/Paging.elm')
-rw-r--r--src/client/elm/View/LoggedIn/Paging.elm47
1 files changed, 24 insertions, 23 deletions
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) ]