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

exclude searching on non user relevant text

ulferts59b8f149a3b1
diff --git a/app/components/projects/settings/life_cycles/step_component.html.erb b/app/components/projects/settings/life_cycles/step_component.html.erb
index 493c89621c3..46e2899ecd5 100644
--- a/app/components/projects/settings/life_cycles/step_component.html.erb
+++ b/app/components/projects/settings/life_cycles/step_component.html.erb
@@ -1,16 +1,16 @@
<%=
flex_layout(align_items: :center,
- justify_content: :space_between) do |definition_container|
- definition_container.with_column(flex_layout: true) do |title_container|
+ justify_content: :space_between) do |step_container|
+ step_container.with_column(flex_layout: true) do |title_container|
title_container.with_column(pt: 1, mr: 3) do
- render(Primer::Beta::Text.new) { definition.name }
+ render(Primer::Beta::Text.new(classes: 'filter-target-visible-text')) { definition.name }
end
title_container.with_column(pt: 1) do
render(Projects::LifeCycleTypeComponent.new(definition))
end
end
# py: 1 quick fix: prevents the row from bouncing as the toggle switch currently changes height while toggling
- definition_container.with_column(py: 1, mr: 2) do
+ step_container.with_column(py: 1, mr: 2) do
# buggy currently:
# small variant + status_label_position: :start leads to a small bounce while toggling
# behavior can be seen on primer's viewbook as well -> https://view-components-storybook.eastus.cloudapp.azure.com/view-components/lookbook/inspect/primer/alpha/toggle_switch/small
diff --git a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb
index 374bb4ed064..fae8cdf15c3 100644
--- a/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb
+++ b/app/components/projects/settings/project_custom_field_sections/custom_field_row_component.html.erb
@@ -5,7 +5,7 @@
}) do |custom_field_container|
custom_field_container.with_column(flex_layout: true) do |title_container|
title_container.with_column(pt: 1, mr: 2) do
- render(Primer::Beta::Text.new) do
+ render(Primer::Beta::Text.new(classes: 'filter-target-visible-text')) do
@project_custom_field.name
end
end
diff --git a/frontend/src/stimulus/controllers/dynamic/filter/filter-list.controller.ts b/frontend/src/stimulus/controllers/dynamic/filter/filter-list.controller.ts
index 420be009852..4272a74adf8 100644
--- a/frontend/src/stimulus/controllers/dynamic/filter/filter-list.controller.ts
+++ b/frontend/src/stimulus/controllers/dynamic/filter/filter-list.controller.ts
@@ -59,12 +59,23 @@ export default class FilterListController extends Controller {
});
}
+ /**
+ * Filters the list of items based on the input value in the filter target.
+ *
+ * This method converts the input value to lowercase and compares it with the text content
+ * of each search item. To avoid unwanted text from being part of the search string. E.g. the
+ * labels of buttons, the method first tries to find an element with the class `filter-target-visible-text`.
+ * If such an element exists, only the content of that element is used for the search.
+ * If the text content includes the input value, the item is shown;
+ * otherwise, it is hidden. Additionally, it controls the visibility of the no results text
+ * based on whether any items match the input value.
+ */
filterLists() {
const query = this.filterTarget.value.toLowerCase();
let showNoResultsText = true;
this.searchItemTargets.forEach((item) => {
- const text = item.textContent?.toLowerCase();
+ const text = item.querySelector('.filter-target-visible-text')?.textContent?.toLowerCase() || item.textContent?.toLowerCase();
if (text?.includes(query)) {
this.setVisibility(item, true);