aboutsummaryrefslogtreecommitdiff
path: root/src/client/View/Payments
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-08-14 09:23:12 +0200
committerJoris Guyonvarch2015-08-14 09:23:12 +0200
commitd25b857d8317d729995d6aa25db7a83fe92a07ef (patch)
treecbd329ea073e3089e67d7faea61b4b25361b0e68 /src/client/View/Payments
parente98879d01b3b427a161d70535a30b2f848400607 (diff)
Translating dates
Diffstat (limited to 'src/client/View/Payments')
-rw-r--r--src/client/View/Payments/Table.elm26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/client/View/Payments/Table.elm b/src/client/View/Payments/Table.elm
index 847c620..e5c1a9a 100644
--- a/src/client/View/Payments/Table.elm
+++ b/src/client/View/Payments/Table.elm
@@ -10,12 +10,14 @@ import Date exposing (Date)
import String exposing (append)
+import Model exposing (Model)
import Model.Payment exposing (Payments, Payment)
import View.Icon exposing (renderIcon)
+import View.Date exposing (renderDate)
-paymentsTable : Payments -> Html
-paymentsTable payments =
+paymentsTable : Model -> Payments -> Html
+paymentsTable model payments =
table
[]
([ tr
@@ -25,27 +27,21 @@ paymentsTable payments =
, th [ class "user" ] [ renderIcon "user" ]
, th [ class "date" ] [ renderIcon "calendar" ]
]
- ] ++ (paymentLines payments))
+ ] ++ (paymentLines model payments))
-paymentLines : Payments -> List Html
-paymentLines payments =
+paymentLines : Model -> Payments -> List Html
+paymentLines model payments =
payments
|> List.sortBy (Date.toTime << .creation)
|> List.reverse
- |> List.map paymentLine
+ |> List.map (paymentLine model)
-paymentLine : Payment -> Html
-paymentLine payment =
+paymentLine : Model -> Payment -> Html
+paymentLine model payment =
tr
[]
[ td [] [ text payment.name ]
, td [] [ text ((toString payment.cost) ++ " €") ]
, td [] [ text payment.userName ]
- , td [] [ text (renderDate payment.creation) ]
+ , td [] [ text (renderDate payment.creation model.translations) ]
]
-
-renderDate : Date -> String
-renderDate date =
- toString (Date.day date)
- |> flip append (" " ++ (toString (Date.month date)) ++ ".")
- |> flip append (" " ++ (toString (Date.year date)))