31 lines
950 B
Haskell
31 lines
950 B
Haskell
|
|
module Web.View.HubRoutingRules.New where
|
||
|
|
|
||
|
|
import Web.Types
|
||
|
|
import Generated.Types
|
||
|
|
import IHP.Prelude
|
||
|
|
import IHP.ViewPrelude
|
||
|
|
|
||
|
|
data NewView = NewView
|
||
|
|
{ rule :: !HubRoutingRule
|
||
|
|
, hubs :: ![Hub]
|
||
|
|
}
|
||
|
|
|
||
|
|
instance View NewView where
|
||
|
|
html NewView { .. } = [hsx|
|
||
|
|
<div class="max-w-lg">
|
||
|
|
<h1 class="text-2xl font-semibold mb-6">New Routing Rule</h1>
|
||
|
|
{renderForm rule hubs}
|
||
|
|
</div>
|
||
|
|
|]
|
||
|
|
|
||
|
|
renderForm :: HubRoutingRule -> [Hub] -> Html
|
||
|
|
renderForm rule hubs = formFor rule [hsx|
|
||
|
|
{(selectField #sourceHubId hubs){ label = "Source Hub" }}
|
||
|
|
{(selectField #targetHubId hubs){ label = "Target Hub" }}
|
||
|
|
{(textField #matchCategory){ helpText = "Leave blank to match any category" }}
|
||
|
|
{(textField #matchWidgetType){ helpText = "Leave blank to match any widget type" }}
|
||
|
|
{(numberField #priority){ helpText = "Higher priority rules are evaluated first" }}
|
||
|
|
{textareaField #notes}
|
||
|
|
{submitButton}
|
||
|
|
|]
|