mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-25 04:43:03 +03:00
elm-review fixes.
This commit is contained in:
parent
229cfba91d
commit
026f6defbd
@ -887,7 +887,7 @@ runServerSide rawFormData (Form _ parser _) =
|
||||
|
||||
|
||||
unwrapValidation : Validation error parsed named constraints -> ( Maybe parsed, Dict String (List error) )
|
||||
unwrapValidation (Pages.Internal.Form.Validation viewField name ( maybeParsed, errors )) =
|
||||
unwrapValidation (Pages.Internal.Form.Validation _ _ ( maybeParsed, errors )) =
|
||||
( maybeParsed, errors )
|
||||
|
||||
|
||||
@ -989,6 +989,7 @@ toDynamicFetcher :
|
||||
userMsg
|
||||
toDynamicFetcher name (Form a b c) =
|
||||
let
|
||||
options : { submitStrategy : SubmitStrategy, method : Method, name : Maybe String, onSubmit : Maybe a }
|
||||
options =
|
||||
{ submitStrategy = FetcherStrategy
|
||||
, method = Post
|
||||
@ -1057,6 +1058,7 @@ toDynamicTransition :
|
||||
userMsg
|
||||
toDynamicTransition name (Form a b c) =
|
||||
let
|
||||
options : { submitStrategy : SubmitStrategy, method : Method, name : Maybe String, onSubmit : Maybe a }
|
||||
options =
|
||||
{ submitStrategy = TransitionStrategy
|
||||
, method = Post
|
||||
@ -1162,7 +1164,7 @@ renderHelper :
|
||||
-> data
|
||||
-> FormInternal error (Validation error parsed named constraints) data (Context error data -> List (Html (Pages.Msg.Msg msg)))
|
||||
-> Html (Pages.Msg.Msg msg)
|
||||
renderHelper attrs maybe options formState data ((FormInternal fieldDefinitions parser toInitialValues) as form) =
|
||||
renderHelper attrs maybe options formState data form =
|
||||
-- TODO Get transition context from `app` so you can check if the current form is being submitted
|
||||
-- TODO either as a transition or a fetcher? Should be easy enough to check for the `id` on either of those?
|
||||
let
|
||||
@ -1201,7 +1203,7 @@ renderStyledHelper :
|
||||
-> data
|
||||
-> FormInternal error (Validation error parsed named constraints) data (Context error data -> List (Html.Styled.Html (Pages.Msg.Msg msg)))
|
||||
-> Html.Styled.Html (Pages.Msg.Msg msg)
|
||||
renderStyledHelper attrs maybe options formState data ((FormInternal fieldDefinitions parser toInitialValues) as form) =
|
||||
renderStyledHelper attrs maybe options formState data form =
|
||||
-- TODO Get transition context from `app` so you can check if the current form is being submitted
|
||||
-- TODO either as a transition or a fetcher? Should be easy enough to check for the `id` on either of those?
|
||||
let
|
||||
@ -1356,6 +1358,7 @@ helperValues toHiddenInput maybe options formState data (FormInternal fieldDefin
|
||||
, data = data
|
||||
}
|
||||
|
||||
children : List view
|
||||
children =
|
||||
parsed.view context
|
||||
|
||||
|
@ -108,11 +108,13 @@ input :
|
||||
List (Html.Attribute msg)
|
||||
-> Form.Validation.Field error parsed Input
|
||||
-> Html msg
|
||||
input attrs (Validation viewField fieldName ( maybeParsed, fieldErrors )) =
|
||||
input attrs (Validation viewField fieldName _) =
|
||||
let
|
||||
justViewField : ViewField Input
|
||||
justViewField =
|
||||
expectViewField viewField
|
||||
|
||||
rawField : { name : String, value : Maybe String, kind : ( Input, List ( String, Encode.Value ) ) }
|
||||
rawField =
|
||||
{ name = fieldName |> Maybe.withDefault ""
|
||||
, value = justViewField.value
|
||||
@ -154,11 +156,13 @@ inputStyled :
|
||||
List (Html.Styled.Attribute msg)
|
||||
-> Form.Validation.Field error parsed Input
|
||||
-> Html.Styled.Html msg
|
||||
inputStyled attrs (Validation viewField fieldName ( maybeParsed, fieldErrors )) =
|
||||
inputStyled attrs (Validation viewField fieldName _) =
|
||||
let
|
||||
justViewField : ViewField Input
|
||||
justViewField =
|
||||
expectViewField viewField
|
||||
|
||||
rawField : { name : String, value : Maybe String, kind : ( Input, List ( String, Encode.Value ) ) }
|
||||
rawField =
|
||||
{ name = fieldName |> Maybe.withDefault ""
|
||||
, value = justViewField.value
|
||||
@ -211,11 +215,13 @@ select :
|
||||
)
|
||||
-> Form.Validation.Field error parsed2 (Options parsed)
|
||||
-> Html msg
|
||||
select selectAttrs enumToOption (Validation viewField fieldName ( maybeParsed, fieldErrors )) =
|
||||
select selectAttrs enumToOption (Validation viewField fieldName _) =
|
||||
let
|
||||
justViewField : ViewField (Options parsed)
|
||||
justViewField =
|
||||
viewField |> expectViewField
|
||||
|
||||
rawField : { name : String, value : Maybe String, kind : ( Options parsed, List ( String, Encode.Value ) ) }
|
||||
rawField =
|
||||
{ name = fieldName |> Maybe.withDefault ""
|
||||
, value = justViewField.value
|
||||
@ -265,11 +271,13 @@ radio :
|
||||
)
|
||||
-> Form.Validation.Field error parsed2 (Options parsed)
|
||||
-> Html msg
|
||||
radio selectAttrs enumToOption (Validation viewField fieldName ( maybeParsed, fieldErrors )) =
|
||||
radio selectAttrs enumToOption (Validation viewField fieldName _) =
|
||||
let
|
||||
justViewField : ViewField (Options parsed)
|
||||
justViewField =
|
||||
viewField |> expectViewField
|
||||
|
||||
rawField : { name : String, value : Maybe String, kind : ( Options parsed, List ( String, Encode.Value ) ) }
|
||||
rawField =
|
||||
{ name = fieldName |> Maybe.withDefault ""
|
||||
, value = justViewField.value
|
||||
@ -340,11 +348,13 @@ radioStyled :
|
||||
)
|
||||
-> Form.Validation.Field error parsed2 (Options parsed)
|
||||
-> Html.Styled.Html msg
|
||||
radioStyled selectAttrs enumToOption (Validation viewField fieldName ( maybeParsed, fieldErrors )) =
|
||||
radioStyled selectAttrs enumToOption (Validation viewField fieldName _) =
|
||||
let
|
||||
justViewField : ViewField (Options parsed)
|
||||
justViewField =
|
||||
viewField |> expectViewField
|
||||
|
||||
rawField : { name : String, value : Maybe String, kind : ( Options parsed, List ( String, Encode.Value ) ) }
|
||||
rawField =
|
||||
{ name = fieldName |> Maybe.withDefault ""
|
||||
, value = justViewField.value
|
||||
|
@ -54,14 +54,14 @@ type alias Validation error parsed kind constraints =
|
||||
|
||||
{-| -}
|
||||
fieldName : Field error parsed kind -> String
|
||||
fieldName (Pages.Internal.Form.Validation viewField name ( maybeParsed, errors )) =
|
||||
fieldName (Pages.Internal.Form.Validation _ name _) =
|
||||
name
|
||||
|> Maybe.withDefault ""
|
||||
|
||||
|
||||
{-| -}
|
||||
fieldStatus : Field error parsed kind -> FieldStatus
|
||||
fieldStatus (Pages.Internal.Form.Validation viewField _ ( maybeParsed, errors )) =
|
||||
fieldStatus (Pages.Internal.Form.Validation viewField _ _) =
|
||||
viewField
|
||||
|> expectViewField
|
||||
|> .status
|
||||
@ -155,7 +155,7 @@ withErrorIf includeError (Pages.Internal.Form.Validation _ key _) error (Pages.I
|
||||
|
||||
{-| -}
|
||||
map : (parsed -> mapped) -> Validation error parsed named constraint -> Validation error mapped named constraint
|
||||
map mapFn (Pages.Internal.Form.Validation viewField name ( maybeParsedA, errorsA )) =
|
||||
map mapFn (Pages.Internal.Form.Validation _ name ( maybeParsedA, errorsA )) =
|
||||
Pages.Internal.Form.Validation Nothing name ( Maybe.map mapFn maybeParsedA, errorsA )
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ andMap =
|
||||
|
||||
{-| -}
|
||||
andThen : (parsed -> Validation error mapped named1 constraints1) -> Validation error parsed named2 constraints2 -> Combined error mapped
|
||||
andThen andThenFn (Pages.Internal.Form.Validation _ name ( maybeParsed, errors )) =
|
||||
andThen andThenFn (Pages.Internal.Form.Validation _ _ ( maybeParsed, errors )) =
|
||||
case maybeParsed of
|
||||
Just parsed ->
|
||||
andThenFn parsed
|
||||
@ -196,7 +196,7 @@ andThen andThenFn (Pages.Internal.Form.Validation _ name ( maybeParsed, errors )
|
||||
|
||||
{-| -}
|
||||
map2 : (a -> b -> c) -> Validation error a named1 constraints1 -> Validation error b named2 constraints2 -> Combined error c
|
||||
map2 f (Pages.Internal.Form.Validation _ name1 ( maybeParsedA, errorsA )) (Pages.Internal.Form.Validation _ name2 ( maybeParsedB, errorsB )) =
|
||||
map2 f (Pages.Internal.Form.Validation _ _ ( maybeParsedA, errorsA )) (Pages.Internal.Form.Validation _ _ ( maybeParsedB, errorsB )) =
|
||||
Pages.Internal.Form.Validation Nothing
|
||||
Nothing
|
||||
( Maybe.map2 f maybeParsedA maybeParsedB
|
||||
|
@ -455,9 +455,7 @@ update config appMsg model =
|
||||
|> startNewGetLoad (currentUrlWithPath redirectTo model) toMsg
|
||||
|
||||
_ ->
|
||||
model
|
||||
|> clearLoadingFetchersAfterDataLoad transitionId
|
||||
|> update config (toMsg response)
|
||||
update config (toMsg response) (clearLoadingFetchersAfterDataLoad transitionId model)
|
||||
|
||||
UserMsg userMsg_ ->
|
||||
case userMsg_ of
|
||||
|
Loading…
Reference in New Issue
Block a user