Content
View differences
Updated by Pavel Balashou almost 2 years ago
**Figma**
https://www.figma.com/design/6RzNWrc8jpqhE7jpaCXsGB/Multi-project-selector?node-id=350-68685&t=z0mZO4YlzQSA6XWq-0
**Acceptance Criteria**
* The **Add Projects** button opens a modal
* User can search and select projects one by be one
* Already previously added projects are disabled
* The form shows **Include sub-projects** checkbox
* When this option is activated we will add all sub-projects of submitted projects to the project attribute
* (This might need limitations on how many can be processed at a time)
**Technical info**
After the merge of PR [https://github.com/opf/openproject/pull/15480](https://github.com/opf/openproject/pull/15480) the autocompleter can be used for projects and allows the definition of **disabledProjects.**
```text
the_form = Class.new(ApplicationForm) do
form do |f|
f.project_autocompleter(
name: :id,
label: Project.model_name.human,
visually_hide_label: true,
autocomplete_options: {
openDirectly: false,
multiple: true,
focusDirectly: false,
dropdownPosition: 'bottom',
disabledProjects: Project.visible.take(10).pluck(:id).to_h { |id| [id, ""] }
}
)
end
end
```
https://www.figma.com/design/6RzNWrc8jpqhE7jpaCXsGB/Multi-project-selector?node-id=350-68685&t=z0mZO4YlzQSA6XWq-0
**Acceptance Criteria**
* The **Add Projects** button opens a modal
* User can search and select projects one by
* Already previously added projects are disabled
* The form shows **Include sub-projects** checkbox
* When this option is activated we will add all sub-projects of submitted projects to the project attribute
* (This might need limitations on how many can be processed at a time)
**Technical info**
After the merge of PR [https://github.com/opf/openproject/pull/15480](https://github.com/opf/openproject/pull/15480) the autocompleter can be used for projects and allows the definition of **disabledProjects.**
```text
the_form = Class.new(ApplicationForm) do
form do |f|
f.project_autocompleter(
name: :id,
label: Project.model_name.human,
visually_hide_label: true,
autocomplete_options: {
openDirectly: false,
multiple: true,
focusDirectly: false,
dropdownPosition: 'bottom',
disabledProjects: Project.visible.take(10).pluck(:id).to_h { |id| [id, ""] }
}
)
end
end
```