Add a "new card" form to each kanban column
Each column gets its own form at the bottom (styled like the sidebar
inbox's), creating the card directly in that status, appended after
its existing cards.
- API: POST /projects/{id}/cards takes an optional status_id, which
must belong to the project (422 otherwise); omitted, it still
defaults to the project's first status as before. Position is
already "end of that status" for free -- createInProject() already
ranks by (owner, project, status).
- cards store: add() takes an optional statusId, forwarded as
status_id when given.
- ProjectView: one draft string per status (keyed by status id) so
typing in one column doesn't touch another's, mirroring the
per-status independence the columns already have for reordering.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -45,8 +45,9 @@ final class CardController extends ProjectScopedController
|
||||
/**
|
||||
* POST /api/projects/{projectId}/cards
|
||||
*
|
||||
* Creates the card directly in the project, in its first status (a
|
||||
* project card always has one -- see the invariant on the `cards` table).
|
||||
* Creates the card directly in the project, at the end of the given
|
||||
* status -- or the project's first status if none is given (a project
|
||||
* card always has one -- see the invariant on the `cards` table).
|
||||
*/
|
||||
public function store(Request $request, Response $response, array $args): Response
|
||||
{
|
||||
@@ -56,12 +57,17 @@ final class CardController extends ProjectScopedController
|
||||
$text = $validator->requiredString('text', self::TEXT_MAX);
|
||||
$complete = $validator->optionalBool('complete') ?? false;
|
||||
$position = $validator->optionalInt('position', 0);
|
||||
$statusId = $validator->optionalInt('status_id', 1);
|
||||
$validator->assert();
|
||||
|
||||
if ($statusId !== null && $this->statuses->findInProject($statusId, $projectId) === null) {
|
||||
throw new ApiException('That status does not belong to this project.', 422);
|
||||
}
|
||||
|
||||
$card = $this->cards->createInProject(
|
||||
$this->user($request)['id'],
|
||||
$projectId,
|
||||
$this->firstStatusId($projectId),
|
||||
$statusId ?? $this->firstStatusId($projectId),
|
||||
$text,
|
||||
$complete,
|
||||
$position,
|
||||
|
||||
Reference in New Issue
Block a user