Rename module.

This commit is contained in:
Dillon Kearns 2022-06-18 10:29:41 -07:00
parent 80e63c3529
commit d5b6c5bd47
10 changed files with 24 additions and 24 deletions

View File

@ -14,8 +14,8 @@ import Html.Attributes as Attr
import MySession
import Pages.Field as Field
import Pages.FieldRenderer as FieldRenderer
import Pages.Form
import Pages.FormParser as FormParser
import Pages.FormState
import Pages.Msg
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
@ -148,7 +148,7 @@ form =
|> Maybe.withDefault []
errorsView field =
(if field.status == Pages.Form.Blurred then
(if field.status == Pages.FormState.Blurred then
field
|> errors
|> List.map (\error -> Html.li [] [ Html.text error ])

View File

@ -10,7 +10,7 @@ import Head.Seo as Seo
import Html exposing (Html)
import Html.Attributes as Attr
import MySession
import Pages.Form
import Pages.FormState
import Pages.Msg
import Pages.PageUrl exposing (PageUrl)
import Pages.Transition
@ -178,7 +178,7 @@ view maybeUrl sharedModel model app =
nameFormView : User -> Maybe Pages.Transition.Transition -> Html (Pages.Msg.Msg userMsg)
nameFormView user maybeTransition =
Html.form
(Pages.Form.listeners "test"
(Pages.FormState.listeners "test"
++ [ Attr.method "POST"
, Pages.Msg.onSubmit
]

View File

@ -14,8 +14,8 @@ import Html.Attributes as Attr
import MySession
import Pages.Field as Field
import Pages.FieldRenderer as FieldRenderer
import Pages.Form
import Pages.FormParser as FormParser
import Pages.FormState
import Pages.Msg
import Pages.PageUrl exposing (PageUrl)
import Pages.Url
@ -135,7 +135,7 @@ formParser =
|> Maybe.withDefault []
errorsView field =
(if field.status == Pages.Form.Blurred then
(if field.status == Pages.FormState.Blurred then
field
|> errors
|> List.map (\error -> Html.li [] [ Html.text error ])

View File

@ -93,7 +93,7 @@ import ErrorPage exposing (ErrorPage)
import Head
import Http
import Pages.Fetcher
import Pages.Form
import Pages.FormState
import Pages.Internal.NotFoundReason exposing (NotFoundReason)
import Pages.Internal.RoutePattern exposing (RoutePattern)
import Pages.Msg
@ -146,7 +146,7 @@ type alias StaticPayload data action routeParams =
-> Pages.Fetcher.Fetcher (Result Http.Error action)
, transition : Maybe Pages.Transition.Transition
, fetchers : List Pages.Transition.FetcherState
, pageFormState : Pages.Form.PageFormState
, pageFormState : Pages.FormState.PageFormState
}

View File

@ -49,7 +49,7 @@ import Effect exposing (Effect)
import ErrorPage exposing (ErrorPage)
import HtmlPrinter
import Lamdera.Wire3
import Pages.Form
import Pages.FormState
import Pages.Internal.String
import Pages.Internal.Platform.ToJsPayload
import Pages.Internal.ResponseSketch exposing (ResponseSketch)
@ -161,7 +161,7 @@ type ActionData
view :
Pages.Form.PageFormState
Pages.FormState.PageFormState
-> List Pages.Transition.FetcherState
-> Maybe Pages.Transition.Transition
-> { path : Path
@ -373,7 +373,7 @@ init currentGlobalModel userFlags sharedData pageData actionData navigationKey m
update : Pages.Form.PageFormState -> List Pages.Transition.FetcherState -> Maybe Pages.Transition.Transition -> Shared.Data -> PageData -> Maybe Browser.Navigation.Key -> Msg -> Model -> ( Model, Effect Msg )
update : Pages.FormState.PageFormState -> List Pages.Transition.FetcherState -> Maybe Pages.Transition.Transition -> Shared.Data -> PageData -> Maybe Browser.Navigation.Key -> Msg -> Model -> ( Model, Effect Msg )
update pageFormState fetchers transition sharedData pageData navigationKey msg model =
case msg of
MsgErrorPage____ msg_ ->

View File

@ -66,7 +66,7 @@ import Html.Styled.Attributes as StyledAttr
import Html.Styled.Lazy
import Json.Encode as Encode
import Pages.Field as Field exposing (Field(..))
import Pages.Form as Form
import Pages.FormState as Form
import Pages.Msg
import Pages.Transition

View File

@ -1,4 +1,4 @@
module Pages.Form exposing (..)
module Pages.FormState exposing (..)
import Dict exposing (Dict)
import Html exposing (Attribute)

View File

@ -27,7 +27,7 @@ import Json.Encode
import Pages.ContentCache as ContentCache
import Pages.Fetcher
import Pages.Flags
import Pages.Form
import Pages.FormState
import Pages.Internal.NotFoundReason exposing (NotFoundReason)
import Pages.Internal.ResponseSketch as ResponseSketch exposing (ResponseSketch)
import Pages.Internal.String as String
@ -331,7 +331,7 @@ type alias Model userModel pageData actionData sharedData =
, transition : Maybe ( Int, Pages.Transition.Transition )
, nextTransitionKey : Int
, inFlightFetchers : Dict Int Pages.Transition.FetcherState
, pageFormState : Pages.Form.PageFormState
, pageFormState : Pages.FormState.PageFormState
}
@ -383,7 +383,7 @@ update config appMsg model =
)
SetField info ->
( { model | pageFormState = Pages.Form.setField info model.pageFormState }
( { model | pageFormState = Pages.FormState.setField info model.pageFormState }
, NoEffect
)
@ -471,7 +471,7 @@ update config appMsg model =
( { model
| pageFormState =
model.pageFormState
|> Pages.Form.setSubmitAttempted
|> Pages.FormState.setSubmitAttempted
-- TODO remove hardcoded fieldId
"test"
}
@ -485,7 +485,7 @@ update config appMsg model =
Pages.Msg.FormFieldEvent value ->
-- TODO when init is called for a new page, also need to clear out client-side `pageFormState`
( { model | pageFormState = Pages.Form.update value model.pageFormState }
( { model | pageFormState = Pages.FormState.update value model.pageFormState }
, NoEffect
)

View File

@ -15,7 +15,7 @@ import Json.Encode
import PageServerResponse exposing (PageServerResponse)
import Pages.Fetcher
import Pages.Flags
import Pages.Form
import Pages.FormState
import Pages.Internal.NotFoundReason exposing (NotFoundReason)
import Pages.Internal.Platform.ToJsPayload
import Pages.Internal.ResponseSketch exposing (ResponseSketch)
@ -46,14 +46,14 @@ type alias ProgramConfig userMsg userModel route pageData actionData sharedData
, pageUrl : Maybe PageUrl
}
-> ( userModel, effect )
, update : Pages.Form.PageFormState -> List Pages.Transition.FetcherState -> Maybe Pages.Transition.Transition -> sharedData -> pageData -> Maybe Browser.Navigation.Key -> userMsg -> userModel -> ( userModel, effect )
, update : Pages.FormState.PageFormState -> List Pages.Transition.FetcherState -> Maybe Pages.Transition.Transition -> sharedData -> pageData -> Maybe Browser.Navigation.Key -> userMsg -> userModel -> ( userModel, effect )
, subscriptions : route -> Path -> userModel -> Sub userMsg
, sharedData : DataSource sharedData
, data : route -> DataSource (PageServerResponse pageData errorPage)
, action : route -> DataSource (PageServerResponse actionData errorPage)
, onActionData : actionData -> Maybe userMsg
, view :
Pages.Form.PageFormState
Pages.FormState.PageFormState
-> List Pages.Transition.FetcherState
-> Maybe Pages.Transition.Transition
->

View File

@ -4,8 +4,8 @@ import Date exposing (Date)
import Dict exposing (Dict)
import Expect
import Pages.Field as Field
import Pages.Form
import Pages.FormParser as FormParser exposing (field)
import Pages.FormState
import Test exposing (Test, describe, test)
@ -231,11 +231,11 @@ expectNoErrors parsed =
]
field : String -> String -> ( String, Pages.Form.FieldState )
field : String -> String -> ( String, Pages.FormState.FieldState )
field name value =
( name
, { value = value
, status = Pages.Form.NotVisited
, status = Pages.FormState.NotVisited
}
)