aboutsummaryrefslogtreecommitdiff
path: root/src/client/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/View')
-rw-r--r--src/client/View/Date.elm35
-rw-r--r--src/client/View/Payments/Add.elm8
-rw-r--r--src/client/View/Payments/Table.elm18
3 files changed, 49 insertions, 12 deletions
diff --git a/src/client/View/Date.elm b/src/client/View/Date.elm
index c96e99e..c239713 100644
--- a/src/client/View/Date.elm
+++ b/src/client/View/Date.elm
@@ -1,19 +1,46 @@
module View.Date
- ( renderDate
+ ( renderShortDate
+ , renderLongDate
) where
import Date exposing (..)
+import String
import Model.Translations exposing (..)
-renderDate : Date -> Translations -> String
-renderDate date translations =
+renderShortDate : Date -> Translations -> String
+renderShortDate date translations =
+ let params =
+ [ String.pad 2 '0' (toString (Date.day date))
+ , String.pad 2 '0' (toString (getMonthNumber (Date.month date)))
+ , toString (Date.year date)
+ ]
+ in getVarMessage params "ShortDate" translations
+
+renderLongDate : Date -> Translations -> String
+renderLongDate date translations =
let params =
[ toString (Date.day date)
, (getMessage (getMonthKey (Date.month date)) translations)
, toString (Date.year date)
]
- in getVarMessage params "Date" translations
+ in getVarMessage params "LongDate" translations
+
+getMonthNumber : Month -> Int
+getMonthNumber month =
+ case month of
+ Jan -> 1
+ Feb -> 2
+ Mar -> 3
+ Apr -> 4
+ May -> 5
+ Jun -> 6
+ Jul -> 7
+ Aug -> 8
+ Sep -> 9
+ Oct -> 10
+ Nov -> 11
+ Dec -> 12
getMonthKey : Month -> String
getMonthKey month =
diff --git a/src/client/View/Payments/Add.elm b/src/client/View/Payments/Add.elm
index c022d01..941f6b8 100644
--- a/src/client/View/Payments/Add.elm
+++ b/src/client/View/Payments/Add.elm
@@ -40,6 +40,7 @@ addPayment model addPayment =
[ id "nameInput"
, value addPayment.name
, on "input" targetValue (Signal.message actions.address << UpdatePayment << UpdateAdd << UpdateName)
+ , maxlength 20
]
[]
, label
@@ -57,6 +58,7 @@ addPayment model addPayment =
[ id "costInput"
, value addPayment.cost
, on "input" targetValue (Signal.message actions.address << UpdatePayment << UpdateAdd << UpdateCost)
+ , maxlength 7
]
[]
, label
@@ -67,8 +69,8 @@ addPayment model addPayment =
div [ class "errorMessage" ] [ text error ]
Nothing ->
text ""
- , button
- [ type' "submit" ]
- [ text (getMessage "Add" model.translations)]
]
+ , button
+ [ type' "submit" ]
+ [ text (getMessage "Add" model.translations)]
]
diff --git a/src/client/View/Payments/Table.elm b/src/client/View/Payments/Table.elm
index a180315..12b1a46 100644
--- a/src/client/View/Payments/Table.elm
+++ b/src/client/View/Payments/Table.elm
@@ -23,7 +23,7 @@ import Update exposing (..)
import Update.Payment exposing (..)
import View.Icon exposing (renderIcon)
-import View.Date exposing (renderDate)
+import View.Date exposing (..)
paymentsTable : Model -> PaymentView -> Html
paymentsTable model paymentView =
@@ -53,10 +53,18 @@ paymentLine model paymentView (id, payment) =
[ class ("row " ++ (if paymentView.edition == Just id then "edition" else ""))
, onClick actions.address (UpdatePayment (ToggleEdit id))
]
- [ div [ class "cell" ] [ text payment.name ]
- , div [ class "cell" ] [ text ((toString payment.cost) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ]
- , div [ class "cell" ] [ text payment.userName ]
- , div [ class "cell" ] [ text (renderDate payment.creation model.translations) ]
+ [ div [ class "cell category" ] [ text payment.name ]
+ , div [ class "cell cost" ] [ text ((toString payment.cost) ++ " " ++ (getMessage "MoneySymbol" model.translations)) ]
+ , div [ class "cell user" ] [ text payment.userName ]
+ , div
+ [ class "cell date" ]
+ [ span
+ [ class "shortDate" ]
+ [ text (renderShortDate payment.creation model.translations) ]
+ , span
+ [ class "longDate" ]
+ [ text (renderLongDate payment.creation model.translations) ]
+ ]
, if paymentView.userName == payment.userName
then
div