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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Create advanced_filters and available_advanced_filters for Project
Dombi Attila7dfbd5e8b5aa
diff --git a/app/components/filter/filter_button_component.rb b/app/components/filter/filter_button_component.rbindex 51ce93967ef..5e19ee52739 100644--- a/app/components/filter/filter_button_component.rb+++ b/app/components/filter/filter_button_component.rb@@ -37,10 +37,7 @@ module Filteroptions :disableddef filters_count- @filters_count ||= query.filters.count do |filter|- # Skip the name filter as we have it present as a permanent filter with a text input.- !filter.is_a?(Queries::Projects::Filters::NameAndIdentifierFilter)- end+ @filters_count ||= query.advanced_filters.countenddef wrapper_keydiff --git a/app/components/filter/filter_component.rb b/app/components/filter/filter_component.rbindex 80099e5ec6b..645c5d8c4a6 100644--- a/app/components/filter/filter_component.rb+++ b/app/components/filter/filter_component.rb@@ -50,12 +50,7 @@ module Filterenddef allowed_filters- query- .available_filters- .reject do |filter|- # Skip the name filter as we have it present as a permanent filter with a text input.- filter.is_a?(Queries::Projects::Filters::NameAndIdentifierFilter)- end+ query.available_advanced_filtersendprotecteddiff --git a/app/models/project_query.rb b/app/models/project_query.rbindex 69a5e337a25..de590fab0eb 100644--- a/app/models/project_query.rb+++ b/app/models/project_query.rb@@ -80,4 +80,11 @@ class ProjectQuery < ApplicationRecordsuper.where(id: Project.visible)endend++ def advanced_filters+ filters.reject do |filter|+ # Skip the name filter as we have it present as a permanent filter with a text input.+ filter.is_a?(Queries::Projects::Filters::NameAndIdentifierFilter)+ end+ endenddiff --git a/app/models/queries/filters/available_filters.rb b/app/models/queries/filters/available_filters.rbindex e8fd71589e1..82743637922 100644--- a/app/models/queries/filters/available_filters.rb+++ b/app/models/queries/filters/available_filters.rb@@ -55,6 +55,13 @@ module Queriesinitialized_filters.select(&:available?)end+ def available_advanced_filters+ available_filters.reject do |filter|+ # Skip the name filter as we have it present as a permanent filter with a text input.+ filter.is_a?(::Queries::Projects::Filters::NameAndIdentifierFilter)+ end+ end+def filter_for(key, no_memoization: false)filter = get_initialized_filter(key, no_memoization)