diff options
author | Joris | 2016-06-25 15:10:03 +0200 |
---|---|---|
committer | Joris | 2016-06-25 22:09:04 +0200 |
commit | 70720548c9af024dbb6080638ac8e5470c2213eb (patch) | |
tree | a149bd6d8f1448de11ac4b0b41c52bc82052035a /src/client/elm/View | |
parent | 4ce4de89a5400b0d8b9cddaa2922901a081fdaaa (diff) |
Use the search to view either punctual or monthly payments
Diffstat (limited to 'src/client/elm/View')
-rw-r--r-- | src/client/elm/View/Form.elm | 41 | ||||
-rw-r--r-- | src/client/elm/View/Header.elm | 6 |
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) ] ] |