generated from coulomb/repo-seed
fix(WP-0017/E3): Layer 3 error fixes — controllers and views
Fix compilation errors across 6 controllers and 29 views: import cleanup, ResponseException pattern for API auth, type fixes, unused import removal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
module Web.View.RequirementCandidates.Edit where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.View.Prelude
|
||||
import Web.Routes ()
|
||||
|
||||
data EditView = EditView
|
||||
@@ -33,16 +30,22 @@ renderForm candidate widgets threads = formFor candidate [hsx|
|
||||
{(textField #title) { fieldLabel = "Title" }}
|
||||
{(textareaField #description) { fieldLabel = "Description" }}
|
||||
{selectField #sourceWidgetId (widgetOptions widgets)}
|
||||
{selectField #sourceThreadId (threadOptions threads)}
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Source Thread</label>
|
||||
<select name="sourceThreadId" class="w-full border border-gray-300 rounded px-3 py-2 text-sm">
|
||||
<option value="">None</option>
|
||||
{forEach threads renderThreadOption}
|
||||
</select>
|
||||
</div>
|
||||
{selectField #category categoryOptions}
|
||||
{submitButton}
|
||||
|]
|
||||
|
||||
widgetOptions :: [Widget] -> [(Text, Text)]
|
||||
widgetOptions = map (\w -> (w.name, show w.id))
|
||||
widgetOptions :: [Widget] -> [(Text, Id Widget)]
|
||||
widgetOptions = map (\w -> (w.name, w.id))
|
||||
|
||||
threadOptions :: [AnnotationThread] -> [(Text, Text)]
|
||||
threadOptions threads = ("None", "") : map (\t -> (t.title, show t.id)) threads
|
||||
renderThreadOption :: AnnotationThread -> Html
|
||||
renderThreadOption t = [hsx|<option value={show t.id}>{t.title}</option>|]
|
||||
|
||||
categoryOptions :: [(Text, Text)]
|
||||
categoryOptions =
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
module Web.View.RequirementCandidates.Index where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.View.Prelude
|
||||
import Web.Routes ()
|
||||
|
||||
data IndexView = IndexView
|
||||
@@ -50,7 +47,7 @@ renderFilterPills current = [hsx|
|
||||
renderPill :: Maybe Text -> Maybe Text -> Text -> Html
|
||||
renderPill target current label =
|
||||
let isActive = target == current
|
||||
baseClass = "text-xs px-3 py-1.5 rounded-full border "
|
||||
baseClass = "text-xs px-3 py-1.5 rounded-full border " :: Text
|
||||
cls = if isActive
|
||||
then baseClass <> "bg-indigo-600 text-white border-indigo-600"
|
||||
else baseClass <> "border-gray-300 text-gray-600 hover:bg-gray-50"
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
module Web.View.RequirementCandidates.New where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.View.Prelude
|
||||
import Web.Routes ()
|
||||
|
||||
data NewView = NewView
|
||||
@@ -30,16 +27,22 @@ renderForm candidate widgets threads = formFor candidate [hsx|
|
||||
{(textField #title) { fieldLabel = "Title" }}
|
||||
{(textareaField #description) { fieldLabel = "Description" }}
|
||||
{selectField #sourceWidgetId (widgetOptions widgets)}
|
||||
{selectField #sourceThreadId (threadOptions threads)}
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Source Thread</label>
|
||||
<select name="sourceThreadId" class="w-full border border-gray-300 rounded px-3 py-2 text-sm">
|
||||
<option value="">None</option>
|
||||
{forEach threads renderThreadOption}
|
||||
</select>
|
||||
</div>
|
||||
{selectField #category categoryOptions}
|
||||
{submitButton}
|
||||
|]
|
||||
|
||||
widgetOptions :: [Widget] -> [(Text, Text)]
|
||||
widgetOptions = map (\w -> (w.name, show w.id))
|
||||
widgetOptions :: [Widget] -> [(Text, Id Widget)]
|
||||
widgetOptions = map (\w -> (w.name, w.id))
|
||||
|
||||
threadOptions :: [AnnotationThread] -> [(Text, Text)]
|
||||
threadOptions threads = ("None", "") : map (\t -> (t.title, show t.id)) threads
|
||||
renderThreadOption :: AnnotationThread -> Html
|
||||
renderThreadOption t = [hsx|<option value={show t.id}>{t.title}</option>|]
|
||||
|
||||
categoryOptions :: [(Text, Text)]
|
||||
categoryOptions =
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
module Web.View.RequirementCandidates.Show where
|
||||
|
||||
import Web.Types
|
||||
import Generated.Types
|
||||
import IHP.Prelude
|
||||
import IHP.ViewPrelude
|
||||
import Web.View.Prelude
|
||||
import Web.Routes ()
|
||||
|
||||
data ShowView = ShowView
|
||||
@@ -122,7 +119,6 @@ renderTriageButton :: Id RequirementCandidate -> Text -> Html
|
||||
renderTriageButton candidateId newStatus = [hsx|
|
||||
<form method="POST" action={UpdateTriageStatusAction (candidateId)}
|
||||
class="inline">
|
||||
{hiddenField "authenticity_token"}
|
||||
<input type="hidden" name="status" value={newStatus} />
|
||||
<button type="submit" class={triageButtonClass newStatus}>
|
||||
→ {newStatus}
|
||||
@@ -144,7 +140,6 @@ renderReviewerSection candidate mAssignment users = [hsx|
|
||||
</div>
|
||||
<form method="POST" action={AssignReviewerAction (candidate.id)}
|
||||
class="flex items-center gap-2">
|
||||
{hiddenField "authenticity_token"}
|
||||
<select name="userId" class="text-sm border border-gray-300 rounded px-2 py-1">
|
||||
{forEach users renderUserOption}
|
||||
</select>
|
||||
@@ -216,7 +211,6 @@ renderPromoteButton candidate =
|
||||
Nothing -> [hsx|
|
||||
<form method="POST"
|
||||
action={PromoteToRequirementAction (candidate.id)}>
|
||||
{hiddenField "authenticity_token"}
|
||||
<button type="submit"
|
||||
class="text-sm bg-indigo-600 text-white px-3 py-1.5 rounded hover:bg-indigo-700">
|
||||
Promote to Requirement
|
||||
@@ -228,7 +222,6 @@ renderLinkDecisionButton :: RequirementCandidate -> Html
|
||||
renderLinkDecisionButton candidate = [hsx|
|
||||
<form method="POST"
|
||||
action={LinkToDecisionAction (candidate.id)}>
|
||||
{hiddenField "authenticity_token"}
|
||||
<button type="submit"
|
||||
class="text-sm bg-gray-700 text-white px-3 py-1.5 rounded hover:bg-gray-800">
|
||||
Create Decision Record
|
||||
|
||||
Reference in New Issue
Block a user