Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

WIP[Op#54749]: more building blocks

Kabiru Mwenjadb7cbe2b99a4
diff --git a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.html.erb b/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.html.erb
index 75c0e713ce2..ce0f1e1750a 100644
--- a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.html.erb
+++ b/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.html.erb
@@ -9,9 +9,33 @@
openDirectly: false,
focusDirectly: false,
dropdownPosition: 'bottom',
- disabledProjects: Project.visible.take(10).pluck(:id).to_h { |id| [id, "Disabled reason!"] }
+ disabledProjects: projects_with_custom_field_mapping
}
)
+
+ f.check_box(
+ name: :include_sub_projects,
+ label: I18n.t("projects.settings.project_custom_fields.new_project_mapping_form.include_sub_projects"),
+ checked: false
+ )
+ end
+
+ def initialize(project_custom_field:)
+ super()
+ @project_custom_field = project_custom_field
+ end
+
+ private
+
+ def projects_with_custom_field_mapping
+ ProjectCustomFieldProjectMapping
+ .where(project_custom_field: @project_custom_field)
+ .pluck(:project_id)
+ .to_h { |id| [id, project_disabled_reason] }
+ end
+
+ def project_disabled_reason
+ I18n.t("projects.settings.project_custom_fields.new_project_mapping_form.autocompleter_disabled_reason")
end
end
%>
@@ -21,17 +45,18 @@
Primer::Alpha::Dialog.new(
id: dialog_id,
title:,
- test_selector: dialog_id
+ test_selector: dialog_id,
+ size: :large
)
) do |dialog|
- dialog.with_show_button(icon: :project, aria: { label: show_button_text }) { show_button_text }
+ dialog.with_show_button(scheme: :primary) { show_button_text }
dialog.with_header(
show_divider: false,
visually_hide_title: false
)
- render(Primer::Beta::Text.new(tag: :div, test_selector: 'storage-oauth-client-form')) do
+ render(Primer::Beta::Text.new(tag: :div)) do
primer_form_with(
model: @project_mapping,
url: link_admin_settings_project_custom_field_path(@project_custom_field),
@@ -40,12 +65,12 @@
concat(render(Primer::Alpha::Dialog::Body.new(
id: dialog_body_id, test_selector: dialog_body_id, aria: { label: title }
)) do
- render(new_project_mapping_form.new(form))
+ render(new_project_mapping_form.new(form, project_custom_field: @project_custom_field))
end)
concat(render(Primer::Alpha::Dialog::Footer.new(show_divider: false)) do
concat(render(Primer::ButtonComponent.new(data: { 'close-dialog-id': dialog_id })) { cancel_button_text })
- concat(render(Primer::ButtonComponent.new(scheme: :primary)) { submit_button_text })
+ concat(render(Primer::ButtonComponent.new(scheme: :primary, type: :submit)) { submit_button_text })
end)
end
end
diff --git a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.rb b/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.rb
index 093061c08bc..765e1b76938 100644
--- a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.rb
+++ b/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.rb
@@ -42,11 +42,11 @@ module Settings
private
def title
- "Add projects"
+ I18n.t("projects.settings.project_custom_fields.new_project_mapping_form.add_projects")
end
def show_button_text
- "Add projects"
+ I18n.t("projects.settings.project_custom_fields.new_project_mapping_form.add_projects")
end
def cancel_button_text
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 5c221a64da4..845f868a640 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -333,6 +333,9 @@ Project attributes and sections are defined in the <a href=%{admin_settings_url}
is_required_blank_slate:
heading: Required in all projects
description: This project attribute is activated in all projects since the "Required in all projects" option is checked. It cannot be deactivated for individual projects.
+ new_project_mapping_form:
+ add_projects: "Add projects"
+ include_sub_projects: "Include sub-projects"
types:
no_results_title_text: There are currently no types available.
form: