Content
View differences
Updated by Judith Roth 2 days ago
**As** a user
**I want to** create a new work package from the document
**so that** I can easily organise work without switching context.
**Acceptance criteria**
* Invoke via Slash command
* Same as for "link work package", but with "create" instead of "link"
* Only users who are allowed to create work packages see the command (?)
* After the slash command is invoked, a modal is shown where required and most important attributes can be set:
* subject
* project
* if rendered in OpenProject context and inside a project, this is prefilled with the current project
* other possible projects can be chosen via dropdown (`/api/v3/work_packages/available_projects`)
* only projects where the user is allowed to create work packages are listed
* type
* the possible types depend on the project (**get** `/api/v3/projects/{id}/types`)
* prefilled with the type that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
* if no work package was created before, the default type is selected (the first in the list)
* status
* prefilled with the status that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
* If no work package was created before, the default status is selected (the first in the list)
* available statuses depend on the type, so the type needs to be chosen first
* assignee
* Prefilled with the assignee that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
* If no work package was created before, it is left empty
* `/api/v3/workspaces/4/available_assignees`
* ... (there are more required fields - we probably should not hardcode them, because there could be fields added)
* The field labels should be translated to the chosen locale (we somehow need to get the translations from OpenProject - if it's complext to do that, it could be a separate PR)
* Creates a work package link the document
* When invoked on an empty paragraph / new line a card work package link is created
* When invoked in the middle of a line a inline work package link is created
**Technical hints**
* An empty POST to `/api/v3/projects/<id>/work_packages/form` returns the schema for the form.
* form. For each attribute it will list if it is required.
* For each attribute it includes either links to the API where allowed values are listed, or allowed values directly as a list.
* There is also `/api/v3/work_packages/schemas/<project-id>-<type-id>` to get the schema for a work package for a project and a given type - however, type id and project need to be known to use this. Probably using the form endpoint mentioned above is the better alternative. links
**Translation considerations**
* The slash command needs to be translated (same logic as for the link work package command)
**I want to** create a new work package from the document
**so that** I can easily organise work without switching context.
**Acceptance criteria**
* Invoke via Slash command
* Same as for "link work package", but with "create" instead of "link"
* Only users who are allowed to create work packages see the command (?)
* After the slash command is invoked, a modal is shown where required and most important attributes can be set:
* subject
* project
* if rendered in OpenProject context and inside a project, this is prefilled with the current project
* other possible projects can be chosen via dropdown (`/api/v3/work_packages/available_projects`)
* only projects where the user is allowed to create work packages are listed
* type
* the possible types depend on the project (**get** `/api/v3/projects/{id}/types`)
* prefilled with the type that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
* if no work package was created before, the default type is selected (the first in the list)
* status
* prefilled with the status that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
* If no work package was created before, the default status is selected (the first in the list)
* available statuses depend on the type, so the type needs to be chosen first
* assignee
* Prefilled with the assignee that was selected on creation of the last work package in op-blocknote-extensions by that user in the same session
* If no work package was created before, it is left empty
* `/api/v3/workspaces/4/available_assignees`
* The field labels should be translated to the chosen locale (we somehow need to get the translations from OpenProject - if it's complext to do that, it could be a separate PR)
* Creates a work package link the document
* When invoked on an empty paragraph / new line a card work package link is created
* When invoked in the middle of a line a inline work package link is created
**Technical hints**
* An empty POST to `/api/v3/projects/<id>/work_packages/form` returns the schema for the form.
*
* For each attribute it includes either links to the API where allowed values are listed, or allowed values directly as a list.
* There is also `/api/v3/work_packages/schemas/<project-id>-<type-id>` to get the schema for a work package for a project and a given type - however, type id and project need to be known to use this. Probably using the form endpoint mentioned above is the better alternative.
**Translation considerations**
* The slash command needs to be translated (same logic as for the link work package command)