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/Form.elm41
-rw-r--r--src/client/elm/View/Header.elm6
2 files changed, 25 insertions, 22 deletions
diff --git a/src/client/elm/View/Form.elm b/src/client/elm/View/Form.elm
index 5471e7d..b123db9 100644
--- a/src/client/elm/View/Form.elm
+++ b/src/client/elm/View/Form.elm
@@ -18,8 +18,8 @@ import Model.Translations as Translations exposing (Translations)
import Utils.Maybe exposing (isJust)
-textInput : Translations -> Form String a -> (Html Form.Msg -> Html msg) -> String -> Html msg
-textInput translations form htmlMap fieldName =
+textInput : Translations -> Form String a -> (Html Form.Msg -> Html msg) -> String -> String -> Html msg
+textInput translations form htmlMap formName fieldName =
let field = Form.getFieldAsString fieldName form
in div
[ classList
@@ -30,19 +30,19 @@ textInput translations form htmlMap fieldName =
[ htmlMap <|
Input.textInput
field
- [ id fieldName
+ [ id (formName ++ fieldName)
, classList [ ("filled", isJust field.value) ]
]
, label
- [ for fieldName ]
- [ text (Translations.getMessage fieldName translations) ]
+ [ for (formName ++ fieldName) ]
+ [ text (Translations.getMessage (formName ++ fieldName) translations) ]
, case field.liveError of
Just error -> formError translations error
Nothing -> text ""
]
-radioInputs : Translations -> Form String a -> (Html Form.Msg -> Html msg) -> String -> List String -> Html msg
-radioInputs translations form htmlMap radioName fieldNames =
+radioInputs : Translations -> Form String a -> (Html Form.Msg -> Html msg) -> String -> String -> List String -> Html msg
+radioInputs translations form htmlMap formName radioName fieldNames =
let field = Form.getFieldAsString radioName form
in div
[ classList
@@ -52,29 +52,32 @@ radioInputs translations form htmlMap radioName fieldNames =
]
[ div
[ class "title" ]
- [ text (Translations.getMessage radioName translations) ]
+ [ text (Translations.getMessage (formName ++ radioName) translations) ]
, div
- [ class "radioElems" ]
- (List.map (radioInput translations field htmlMap) fieldNames)
+ [ class "radioInputs" ]
+ (List.map (radioInput translations field htmlMap formName) fieldNames)
, case field.liveError of
Just error -> formError translations error
Nothing -> text ""
]
-radioInput : Translations -> FieldState String String -> (Html Form.Msg -> Html msg) -> String -> Html msg
-radioInput translations field htmlMap fieldName =
- label
- [ for fieldName ]
- [ htmlMap <|
- Input.radioInput
+radioInput : Translations -> FieldState String String -> (Html Form.Msg -> Html msg) -> String -> String -> Html msg
+radioInput translations field htmlMap formName fieldName =
+ htmlMap <|
+ div
+ [ class "radioInput" ]
+ [ Input.radioInput
field.path
field
- [ id fieldName
+ [ id (formName ++ fieldName)
, value fieldName
, checked (field.value == Just fieldName)
]
- , text (Translations.getMessage fieldName translations)
- ]
+ , label
+ [ for (formName ++ fieldName) ]
+ [ text (Translations.getMessage (formName ++ fieldName) translations)
+ ]
+ ]
formError : Translations -> FormError.Error String -> Html msg
formError translations error =
diff --git a/src/client/elm/View/Header.elm b/src/client/elm/View/Header.elm
index 5f38c31..00f55d5 100644
--- a/src/client/elm/View/Header.elm
+++ b/src/client/elm/View/Header.elm
@@ -1,5 +1,5 @@
module View.Header exposing
- ( renderHeader
+ ( view
)
import Dict
@@ -18,8 +18,8 @@ import Model.Translations exposing (getMessage)
import Msg exposing (..)
import Model.View exposing (..)
-renderHeader : Model -> Html Msg
-renderHeader model =
+view : Model -> Html Msg
+view model =
header
[]
( [ div [ class "title" ] [ text (getMessage "SharedCost" model.translations) ] ]