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

Add documentation for the `additional_filter_attributes` method

Klaus Zanders350818f0e304
diff --git a/app/components/filters_component.rb b/app/components/filters_component.rb
index 124a00488c8..78c28a4fa9d 100644
--- a/app/components/filters_component.rb
+++ b/app/components/filters_component.rb
@@ -63,6 +63,13 @@ class FiltersComponent < ApplicationComponent
protected
+ # With this method we can pass additional options for each type of filter into the frontend. This is especially
+ # useful when we want to pass options for the autocompleter components.
+ #
+ # When the method is overwritten in a subclass, the subclass should call super(filter) to get the default attributes.
+ #
+ # @param filter [QueryFilter] the filter for which we want to pass additional attributes
+ # @return [Hash] the additional attributes for the filter, that will be yielded in the each_filter method
def additional_filter_attributes(filter)
case filter
when Queries::Filters::Shared::ProjectFilter