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

[#56440] Add 🔍 to projects autocompleter

Judith Rothcdbecbb22e10
diff --git a/app/components/_index.sass b/app/components/_index.sass
index 2f1db2aa1ed..bf0cfde0364 100644
--- a/app/components/_index.sass
+++ b/app/components/_index.sass
@@ -7,5 +7,4 @@
@import "open_project/common/submenu_component"
@import "filter/filters_component"
@import "projects/row_component"
-@import "settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component"
@import "op_primer/border_box_table_component"
diff --git a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.sass b/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.sass
deleted file mode 100644
index 76511b9c5b3..00000000000
--- a/app/components/settings/project_custom_fields/project_custom_field_mapping/new_project_mapping_component.sass
+++ /dev/null
@@ -1,8 +0,0 @@
-@import 'helpers'
-
-.op-new-project-mapping-form
- .ng-placeholder
- @extend .icon-search
- &:before
- @include icon-font-common
- margin-right: 10px
diff --git a/app/forms/projects/custom_fields/custom_field_mapping_form.rb b/app/forms/projects/custom_fields/custom_field_mapping_form.rb
index a6076e7d59a..cda7e1c10e4 100644
--- a/app/forms/projects/custom_fields/custom_field_mapping_form.rb
+++ b/app/forms/projects/custom_fields/custom_field_mapping_form.rb
@@ -38,6 +38,7 @@ module Projects::CustomFields
visually_hide_label: true,
validation_message: project_ids_error_message,
autocomplete_options: {
+ with_search_icon: true,
openDirectly: false,
focusDirectly: false,
multiple: true,
diff --git a/frontend/src/global_styles/content/_index.sass b/frontend/src/global_styles/content/_index.sass
index fc01f272df4..5e3ab924f63 100644
--- a/frontend/src/global_styles/content/_index.sass
+++ b/frontend/src/global_styles/content/_index.sass
@@ -54,6 +54,7 @@
@import autocomplete
@import autocomplete_primerized
@import diff
+@import projects_autocomplete_with_search_icon
@import projects_list
@import project_list_modal
@import datepicker
diff --git a/frontend/src/global_styles/content/_projects_autocomplete_with_search_icon.sass b/frontend/src/global_styles/content/_projects_autocomplete_with_search_icon.sass
new file mode 100644
index 00000000000..50a53108fc8
--- /dev/null
+++ b/frontend/src/global_styles/content/_projects_autocomplete_with_search_icon.sass
@@ -0,0 +1,11 @@
+@import 'helpers'
+
+.projects-autocomplete-with-search-icon
+ ng-select
+ .ng-placeholder
+ margin-left: 18px
+ .ng-value-container
+ @extend .icon-search
+ &:before
+ @include icon-font-common
+ padding-right: 5px
diff --git a/lib/primer/open_project/forms/autocompleter.html.erb b/lib/primer/open_project/forms/autocompleter.html.erb
index 751846cec8b..f21b59f522c 100644
--- a/lib/primer/open_project/forms/autocompleter.html.erb
+++ b/lib/primer/open_project/forms/autocompleter.html.erb
@@ -11,14 +11,16 @@
append_to: @autocomplete_options.fetch(:append_to, 'body')
} %>
<% else %>
- <%= angular_component_tag @autocomplete_options.fetch(:component),
- data: @autocomplete_options.delete(:data) { {} },
- inputs: @autocomplete_options.merge(
- classes: "ng-select--primerized #{@input.invalid? ? '-error' : ''}",
- inputName: @autocomplete_options.fetch(:inputName) { builder.field_name(@input.name) },
- inputValue: @autocomplete_options.fetch(:inputValue) { builder.object.send(@input.name) },
- defaultData: @autocomplete_options.fetch(:defaultData) { true }
- )
- %>
+ <%= content_tag(:div, class: ("projects-autocomplete-with-search-icon" if @autocomplete_options.delete(:with_search_icon))) do %>
+ <%= angular_component_tag @autocomplete_options.fetch(:component),
+ data: @autocomplete_options.delete(:data) { {} },
+ inputs: @autocomplete_options.merge(
+ classes: "ng-select--primerized #{@input.invalid? ? '-error' : ''}",
+ inputName: @autocomplete_options.fetch(:inputName) { builder.field_name(@input.name) },
+ inputValue: @autocomplete_options.fetch(:inputValue) { builder.object.send(@input.name) },
+ defaultData: @autocomplete_options.fetch(:defaultData) { true }
+ )
+ %>
+ <% end %>
<% end %>
<% end %>
diff --git a/modules/storages/app/forms/storages/admin/storages/add_projects_autocompleter_form.rb b/modules/storages/app/forms/storages/admin/storages/add_projects_autocompleter_form.rb
index 62e719e324a..0d63feae9a9 100644
--- a/modules/storages/app/forms/storages/admin/storages/add_projects_autocompleter_form.rb
+++ b/modules/storages/app/forms/storages/admin/storages/add_projects_autocompleter_form.rb
@@ -38,6 +38,7 @@ module Storages
visually_hide_label: true,
validation_message: project_ids_error_message,
autocomplete_options: {
+ with_search_icon: true,
openDirectly: false,
focusDirectly: false,
multiple: true,