Rename function.

This commit is contained in:
Dillon Kearns 2022-06-18 10:02:59 -07:00
parent 814794db19
commit 9b5a1871b3
6 changed files with 15 additions and 15 deletions

View File

@ -125,7 +125,7 @@ type Action
signoutForm : FormParser.HtmlForm String Action input Msg
signoutForm =
FormParser.andThenNew
FormParser.init
(FormParser.ok Signout)
(\formState ->
( []
@ -138,7 +138,7 @@ signoutForm =
setQuantityForm : FormParser.HtmlForm String Action ( Int, Smoothie ) Msg
setQuantityForm =
FormParser.andThenNew
FormParser.init
(\uuid quantity ->
SetQuantity (Uuid uuid.value) quantity.value
|> FormParser.ok

View File

@ -131,7 +131,7 @@ head static =
form : FormParser.HtmlForm String { name : String, description : String, price : Int, imageUrl : String } Data Msg
form =
FormParser.andThenNew
FormParser.init
(\name description price imageUrl ->
FormParser.ok
{ name = name.value

View File

@ -120,7 +120,7 @@ type alias Action =
formParser : FormParser.HtmlForm String { username : String, name : String } Data msg
formParser =
FormParser.andThenNew
FormParser.init
(\username name ->
FormParser.ok
{ username = username.value

View File

@ -174,7 +174,7 @@ type Action
deleteForm : FormParser.HtmlForm String Action data Msg
deleteForm =
FormParser.andThenNew
FormParser.init
(FormParser.ok Delete)
(\formState ->
( []
@ -190,7 +190,7 @@ deleteForm =
form : FormParser.HtmlForm String Action Data Msg
form =
FormParser.andThenNew
FormParser.init
(\name description price imageUrl media myCheckbox checkin checkout ->
if Date.toRataDie checkin.value >= Date.toRataDie checkout.value then
( Nothing

View File

@ -1,6 +1,6 @@
module Pages.FormParser exposing
( FieldErrors, HtmlForm
, andThenNew
, init
, addErrors, toResult
, field, hiddenField, hiddenKind
, ParsedField, ok
@ -18,7 +18,7 @@ module Pages.FormParser exposing
@docs CombinedParser, FieldErrors, HtmlForm
@docs andThenNew
@docs init
@docs addErrors, toResult
@ -102,8 +102,8 @@ type alias Context error =
{-| -}
andThenNew : combined -> (Context String -> viewFn) -> Form String combined data (Context String -> viewFn)
andThenNew fn viewFn =
init : combined -> (Context String -> viewFn) -> Form String combined data (Context String -> viewFn)
init fn viewFn =
Form []
(\maybeData formState ->
{ result = ( Just fn, Dict.empty )

View File

@ -23,7 +23,7 @@ all =
describe "Form Parser" <|
let
passwordConfirmationParser =
FormParser.andThenNew
FormParser.init
(\password passwordConfirmation ->
if password.value /= passwordConfirmation.value then
( Nothing
@ -68,11 +68,11 @@ all =
, describe "oneOf" <|
let
oneOfParsers =
[ FormParser.andThenNew
[ FormParser.init
(\_ -> FormParser.ok Signout)
(\fieldErrors -> Div)
|> FormParser.hiddenField "kind" (Field.exactValue "signout" "Expected signout")
, FormParser.andThenNew
, FormParser.init
(\_ uuid quantity ->
SetQuantity (Uuid uuid.value) quantity.value
|> FormParser.ok
@ -122,7 +122,7 @@ all =
, describe "select" <|
let
selectParser =
[ FormParser.andThenNew
[ FormParser.init
(\media ->
media.value
|> FormParser.ok
@ -156,7 +156,7 @@ all =
--checkinFormParser : FormParser.HtmlForm String ( Date, Date ) data msg
checkinFormParser : FormParser.Form String ( Maybe ( Date, Date ), Dict String (List String) ) data (FormParser.Context String -> MyView)
checkinFormParser =
FormParser.andThenNew
FormParser.init
(\checkin checkout ->
if Date.toRataDie checkin.value >= Date.toRataDie checkout.value then
( Just ( checkin.value, checkout.value )