From 70720548c9af024dbb6080638ac8e5470c2213eb Mon Sep 17 00:00:00 2001 From: Joris Date: Sat, 25 Jun 2016 15:10:03 +0200 Subject: Use the search to view either punctual or monthly payments --- src/client/elm/View/Form.elm | 41 ++++++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 19 deletions(-) (limited to 'src/client/elm/View/Form.elm') 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 = -- cgit v1.2.3