aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/elm/View')
-rw-r--r--src/client/elm/View/Date.elm8
-rw-r--r--src/client/elm/View/Errors.elm21
-rw-r--r--src/client/elm/View/Form.elm8
-rw-r--r--src/client/elm/View/Header.elm4
-rw-r--r--src/client/elm/View/Plural.elm4
5 files changed, 33 insertions, 12 deletions
diff --git a/src/client/elm/View/Date.elm b/src/client/elm/View/Date.elm
index 21bbfc4..35806ba 100644
--- a/src/client/elm/View/Date.elm
+++ b/src/client/elm/View/Date.elm
@@ -17,19 +17,19 @@ shortView date translations =
, String.pad 2 '0' (toString (Date.monthToInt (Date.month date)))
, toString (Date.year date)
]
- in getParamMessage params "ShortDate" translations
+ in getParamMessage params translations "ShortDate"
longView : Date -> Translations -> String
longView date translations =
let params =
[ toString (Date.day date)
- , (getMessage (getMonthKey (Date.month date)) translations)
+ , (getMessage translations (getMonthKey (Date.month date)))
, toString (Date.year date)
]
- in getParamMessage params "LongDate" translations
+ in getParamMessage params translations "LongDate"
monthView : Translations -> Month -> String
-monthView translations month = getMessage (getMonthKey month) translations
+monthView translations month = getMessage translations (getMonthKey month)
getMonthKey : Month -> String
getMonthKey month =
diff --git a/src/client/elm/View/Errors.elm b/src/client/elm/View/Errors.elm
new file mode 100644
index 0000000..3e25c99
--- /dev/null
+++ b/src/client/elm/View/Errors.elm
@@ -0,0 +1,21 @@
+module View.Errors exposing
+ ( view
+ )
+
+import Html exposing (..)
+import Html.Attributes exposing (..)
+import Html.Events exposing (..)
+
+import Model.Translations exposing (Translations, getMessage)
+
+view : Translations -> List String -> Html msg
+view translations errors =
+ ul
+ [ class "errors" ]
+ ( List.map (errorView translations) errors)
+
+errorView : Translations -> String -> Html msg
+errorView translations error =
+ li
+ [ class "error" ]
+ [ text <| getMessage translations error ]
diff --git a/src/client/elm/View/Form.elm b/src/client/elm/View/Form.elm
index 5f642fb..dcde47d 100644
--- a/src/client/elm/View/Form.elm
+++ b/src/client/elm/View/Form.elm
@@ -40,7 +40,7 @@ textInput translations form formName fieldName =
]
, label
[ for (formName ++ fieldName) ]
- [ text (Translations.getMessage (formName ++ fieldName) translations) ]
+ [ text (Translations.getMessage translations (formName ++ fieldName)) ]
, button
[ type' "button"
, onClick (Form.Input fieldName Field.EmptyField)
@@ -63,7 +63,7 @@ radioInputs translations form formName radioName fieldNames =
]
[ div
[ class "title" ]
- [ text (Translations.getMessage (formName ++ radioName) translations) ]
+ [ text (Translations.getMessage translations (formName ++ radioName) ) ]
, div
[ class "radioInputs" ]
(List.map (radioInput translations field formName) fieldNames)
@@ -85,7 +85,7 @@ radioInput translations field formName fieldName =
]
, label
[ for (formName ++ fieldName) ]
- [ text (Translations.getMessage (formName ++ fieldName) translations)
+ [ text (Translations.getMessage translations (formName ++ fieldName))
]
]
@@ -94,7 +94,7 @@ formError translations error =
let errorElement error params =
div
[ class "errorMessage" ]
- [ text (Translations.getParamMessage params error translations) ]
+ [ text (Translations.getParamMessage params translations error) ]
in case error of
CustomError key -> errorElement key []
SmallerIntThan n -> errorElement "SmallerIntThan" [toString n]
diff --git a/src/client/elm/View/Header.elm b/src/client/elm/View/Header.elm
index d5969b9..08a429f 100644
--- a/src/client/elm/View/Header.elm
+++ b/src/client/elm/View/Header.elm
@@ -22,7 +22,7 @@ view : Model -> Html Msg
view model =
header
[]
- ( [ div [ class "title" ] [ text (getMessage "SharedCost" model.translations) ] ]
+ ( [ div [ class "title" ] [ text (getMessage model.translations "SharedCost") ] ]
++ let item page name =
a
[ href (Page.toHash page)
@@ -31,7 +31,7 @@ view model =
, ("current", model.page == page)
]
]
- [ text (getMessage name model.translations)
+ [ text (getMessage model.translations name)
]
in case model.view of
LoggedInView { me, users } ->
diff --git a/src/client/elm/View/Plural.elm b/src/client/elm/View/Plural.elm
index ab91f06..c36eaca 100644
--- a/src/client/elm/View/Plural.elm
+++ b/src/client/elm/View/Plural.elm
@@ -6,6 +6,6 @@ import Model.Translations exposing (Translations, getMessage)
plural : Translations -> Int -> String -> String -> String
plural translations n single multiple =
- let singleMessage = getMessage single translations
- multipleMessage = getMessage multiple translations
+ let singleMessage = getMessage translations single
+ multipleMessage = getMessage translations multiple
in (toString n) ++ " " ++ if n <= 1 then singleMessage else multipleMessage