diff --git a/examples/smoothies/app/Route/New.elm b/examples/smoothies/app/Route/New.elm index 051d40ca..c485bcee 100644 --- a/examples/smoothies/app/Route/New.elm +++ b/examples/smoothies/app/Route/New.elm @@ -210,7 +210,7 @@ view maybeUrl sharedModel model app = pendingCreation : Result (FormParser.FieldErrors String) NewItem pendingCreation = form - |> FormParser.runNew app app.data + |> FormParser.parse app app.data |> .result |> parseIgnoreErrors in diff --git a/examples/smoothies/app/Route/SmoothieId_/Edit.elm b/examples/smoothies/app/Route/SmoothieId_/Edit.elm index bb4c121d..8dadbc21 100644 --- a/examples/smoothies/app/Route/SmoothieId_/Edit.elm +++ b/examples/smoothies/app/Route/SmoothieId_/Edit.elm @@ -338,7 +338,7 @@ view maybeUrl sharedModel model app = pendingCreation : Maybe NewItem pendingCreation = form - |> FormParser.runNew app app.data + |> FormParser.parse app app.data |> .result |> parseIgnoreErrors |> Result.toMaybe diff --git a/src/Pages/FormParser.elm b/src/Pages/FormParser.elm index 77fb6b3a..202400ff 100644 --- a/src/Pages/FormParser.elm +++ b/src/Pages/FormParser.elm @@ -6,7 +6,7 @@ module Pages.FormParser exposing , ParsedField, ok , Context, ViewField , renderHtml, renderStyledHtml - , runNew, runOneOfServerSide, runServerSide + , parse, runOneOfServerSide, runServerSide , FieldDefinition(..) ) @@ -44,7 +44,7 @@ module Pages.FormParser exposing ## Running Parsers -@docs runNew, runOneOfServerSide, runServerSide +@docs parse, runOneOfServerSide, runServerSide ## Internal-Only? @@ -415,16 +415,15 @@ mergeResults parsed = {-| -} -runNew : +parse : AppContext app -> data - ---> CombinedParser error parsed data (Context error -> view) -> Form error ( Maybe parsed, FieldErrors error ) data (Context error -> view) -> { result : ( Maybe parsed, FieldErrors error ) , view : view } -runNew app data (Form fieldDefinitions parser _) = +parse app data (Form fieldDefinitions parser _) = -- 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