mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-12-26 13:21:42 +03:00
Remove obsolete function.
This commit is contained in:
parent
926d56af84
commit
32c451fe82
42
src/Form.elm
42
src/Form.elm
@ -7,7 +7,7 @@ module Form exposing
|
|||||||
, renderHtml, renderStyledHtml
|
, renderHtml, renderStyledHtml
|
||||||
, FinalForm, withGetMethod, toDynamicTransition, toDynamicFetcher
|
, FinalForm, withGetMethod, toDynamicTransition, toDynamicFetcher
|
||||||
, Errors, errorsForField
|
, Errors, errorsForField
|
||||||
, parse, runOneOfServerSide, runServerSide, runServerSideWithoutServerValidations
|
, parse, runOneOfServerSide, runServerSide
|
||||||
, dynamic
|
, dynamic
|
||||||
, runOneOfServerSideWithServerValidations
|
, runOneOfServerSideWithServerValidations
|
||||||
, AppContext
|
, AppContext
|
||||||
@ -242,7 +242,7 @@ Totally customizable. Uses [`Form.FieldView`](Form-FieldView) to render all of t
|
|||||||
|
|
||||||
## Running Parsers
|
## Running Parsers
|
||||||
|
|
||||||
@docs parse, runOneOfServerSide, runServerSide, runServerSideWithoutServerValidations
|
@docs parse, runOneOfServerSide, runServerSide
|
||||||
|
|
||||||
|
|
||||||
## Dynamic Fields
|
## Dynamic Fields
|
||||||
@ -879,42 +879,6 @@ runServerSide rawFormData (Form _ parser _) =
|
|||||||
|> unwrapValidation
|
|> unwrapValidation
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
|
||||||
runServerSideWithoutServerValidations :
|
|
||||||
List ( String, String )
|
|
||||||
-> Form error { all | combine : Validation error parsed kind constraints } data
|
|
||||||
-> ( Maybe parsed, Dict String (List error) )
|
|
||||||
runServerSideWithoutServerValidations rawFormData (Form _ parser _) =
|
|
||||||
let
|
|
||||||
parsed :
|
|
||||||
{ result : Dict String (List error)
|
|
||||||
, combineAndView : { all | combine : Validation error parsed kind constraints }
|
|
||||||
}
|
|
||||||
parsed =
|
|
||||||
parser Nothing thisFormState
|
|
||||||
|
|
||||||
thisFormState : FormState
|
|
||||||
thisFormState =
|
|
||||||
{ initFormState
|
|
||||||
| fields =
|
|
||||||
rawFormData
|
|
||||||
|> List.map
|
|
||||||
(Tuple.mapSecond
|
|
||||||
(\value ->
|
|
||||||
{ value = value
|
|
||||||
, status = Form.NotVisited
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|> Dict.fromList
|
|
||||||
}
|
|
||||||
in
|
|
||||||
{ result = ( parsed.combineAndView.combine, parsed.result )
|
|
||||||
}
|
|
||||||
|> mergeResults
|
|
||||||
|> unwrapValidation
|
|
||||||
|
|
||||||
|
|
||||||
unwrapValidation : Validation error parsed named constraints -> ( Maybe parsed, Dict String (List error) )
|
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 viewField name ( maybeParsed, errors )) =
|
||||||
( maybeParsed, errors )
|
( maybeParsed, errors )
|
||||||
@ -937,7 +901,7 @@ runOneOfServerSide rawFormData parsers =
|
|||||||
let
|
let
|
||||||
thing : ( Maybe parsed, List ( String, List error ) )
|
thing : ( Maybe parsed, List ( String, List error ) )
|
||||||
thing =
|
thing =
|
||||||
runServerSideWithoutServerValidations rawFormData firstParser
|
runServerSide rawFormData firstParser
|
||||||
|> Tuple.mapSecond
|
|> Tuple.mapSecond
|
||||||
(\errors ->
|
(\errors ->
|
||||||
errors
|
errors
|
||||||
|
@ -44,7 +44,7 @@ all =
|
|||||||
in
|
in
|
||||||
[ test "matching password" <|
|
[ test "matching password" <|
|
||||||
\() ->
|
\() ->
|
||||||
Form.runServerSideWithoutServerValidations
|
Form.runServerSide
|
||||||
(fields
|
(fields
|
||||||
[ ( "password", "mypassword" )
|
[ ( "password", "mypassword" )
|
||||||
, ( "password-confirmation", "mypassword" )
|
, ( "password-confirmation", "mypassword" )
|
||||||
@ -57,7 +57,7 @@ all =
|
|||||||
)
|
)
|
||||||
, test "non-matching password" <|
|
, test "non-matching password" <|
|
||||||
\() ->
|
\() ->
|
||||||
Form.runServerSideWithoutServerValidations
|
Form.runServerSide
|
||||||
(fields
|
(fields
|
||||||
[ ( "password", "mypassword" )
|
[ ( "password", "mypassword" )
|
||||||
, ( "password-confirmation", "doesnt-match-password" )
|
, ( "password-confirmation", "doesnt-match-password" )
|
||||||
@ -210,7 +210,7 @@ all =
|
|||||||
)
|
)
|
||||||
, test "checkout is invalid because before checkin" <|
|
, test "checkout is invalid because before checkin" <|
|
||||||
\() ->
|
\() ->
|
||||||
Form.runServerSideWithoutServerValidations
|
Form.runServerSide
|
||||||
(fields
|
(fields
|
||||||
[ ( "checkin", "2022-01-03" )
|
[ ( "checkin", "2022-01-03" )
|
||||||
, ( "checkout", "2022-01-01" )
|
, ( "checkout", "2022-01-01" )
|
||||||
@ -225,7 +225,7 @@ all =
|
|||||||
)
|
)
|
||||||
, test "sub-form" <|
|
, test "sub-form" <|
|
||||||
\() ->
|
\() ->
|
||||||
Form.runServerSideWithoutServerValidations
|
Form.runServerSide
|
||||||
(fields
|
(fields
|
||||||
[ ( "password", "mypassword" )
|
[ ( "password", "mypassword" )
|
||||||
, ( "password-confirmation", "doesnt-match" )
|
, ( "password-confirmation", "doesnt-match" )
|
||||||
|
Loading…
Reference in New Issue
Block a user