module IHP.IDE.CodeGen.View.NewAction where import IHP.ViewPrelude import IHP.IDE.ToolServer.Types import IHP.IDE.CodeGen.Types import IHP.IDE.CodeGen.View.Generators (renderPlan) data NewActionView = NewActionView { plan :: Either Text [GeneratorAction] , actionName :: Text , controllerName :: Text , applicationName :: Text , doGenerateView :: Bool , controllers :: [Text] , applications :: [Text] } instance View NewActionView where html NewActionView { .. } = [hsx|
{if isEmpty then renderEmpty else renderPreview} {unless isEmpty (renderPlan plan)}
|] where renderEmpty = [hsx|
{when (length applications /= 1) renderApplicationSelector}
|] renderControllerOptions = forM_ controllers (\x -> [hsx||]) renderApplicationOptions = forM_ applications (\x -> [hsx||]) renderApplicationSelector = [hsx| |] renderPreview = [hsx|
{controllerName}.{actionName}
|] isEmpty = null actionName