Files
inter-hub/Web/View/WidgetOwnerships/Edit.hs
Bernd Worsch 2c22766cd6 fix(WP-0017/E5): Layer 3 error fixes — round 3 (24 files)
Int16→Int in score/stars functions; uuid-based readMay→UUID.fromText;
autoRefresh do-notation fix; id→\x->x ambiguity in HubRoutingRules;
MarketplaceDashboard replaced raw SQL with IHP query builder; optional
hub selector in TypeRegistry views via CanSelect (Text, Maybe Id) instance
added to Web.View.Prelude; import consolidations to Web.View.Prelude.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-12 13:11:32 +00:00

40 lines
1.2 KiB
Haskell

module Web.View.WidgetOwnerships.Edit where
import Web.View.Prelude
import Web.Routes ()
data EditView = EditView
{ ownership :: !WidgetOwnership
, widgets :: ![Widget]
, hubs :: ![Hub]
}
instance View EditView where
html EditView { .. } = [hsx|
<div class="max-w-lg">
<h1 class="text-2xl font-semibold mb-6">Edit Ownership</h1>
{renderForm ownership hubs}
</div>
|]
renderForm :: WidgetOwnership -> [Hub] -> Html
renderForm ownership hubs = formFor ownership [hsx|
<div>
<label class="ihp-form-label">Steward Hub (optional)</label>
<select name="stewardHubId" class="ihp-form-field">
<option value=""> None </option>
{forEach hubs renderHubOption}
</select>
</div>
{(selectField #ownershipType ownershipTypes){ fieldLabel = "Ownership Type" }}
{dateTimeField #effectiveUntil}
{textareaField #notes}
{submitButton}
|]
where
ownershipTypes :: [(Text, Text)]
ownershipTypes = [("local","local"), ("delegated","delegated"), ("global","global")]
renderHubOption :: Hub -> Html
renderHubOption h = [hsx|<option value={tshow h.id}>{h.name}</option>|]