aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Payments/Paging.elm
diff options
context:
space:
mode:
authorJoris2015-09-04 09:52:20 +0200
committerJoris2015-09-04 09:52:20 +0200
commitc1f44a5890fbb26faf6f17c676662ea1bd495f2e (patch)
treef158bdef5bd985a9b11d46d12878d566268cf6cc /src/client/View/Payments/Paging.elm
parent889df8caf04de5f10a9e623bab3e502e9573159d (diff)
downloadbudget-c1f44a5890fbb26faf6f17c676662ea1bd495f2e.tar.gz
budget-c1f44a5890fbb26faf6f17c676662ea1bd495f2e.tar.bz2
budget-c1f44a5890fbb26faf6f17c676662ea1bd495f2e.zip
Adding paging (need some fixes)
Diffstat (limited to 'src/client/View/Payments/Paging.elm')
-rw-r--r--src/client/View/Payments/Paging.elm31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/client/View/Payments/Paging.elm b/src/client/View/Payments/Paging.elm
new file mode 100644
index 0000000..7be4c7b
--- /dev/null
+++ b/src/client/View/Payments/Paging.elm
@@ -0,0 +1,31 @@
+module View.Payments.Paging
+ ( paymentsPaging
+ ) where
+
+import Html exposing (..)
+import Html.Attributes exposing (..)
+import Html.Events exposing (..)
+
+import Model.View.PaymentView exposing (..)
+import Model.Payment exposing (perPage)
+
+import ServerCommunication as SC exposing (serverCommunications)
+
+import Update exposing (..)
+import Update.Payment exposing (..)
+
+paymentsPaging : PaymentView -> Html
+paymentsPaging paymentView =
+ let maxPage = ceiling (toFloat paymentView.paymentsCount / toFloat perPage)
+ pages = [1..maxPage]
+ in ul
+ [ class "pages" ]
+ ( pages
+ |> List.map (\page ->
+ li
+ [ class ("page" ++ (if page == paymentView.currentPage then " current" else ""))
+ , onClick serverCommunications.address (SC.UpdatePage page)
+ ]
+ [ text (toString page) ]
+ )
+ )