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

Extract FilterButton from FilterComponent to be able to use them separately in the subheader

Henriette Darge25917115cad9
diff --git a/app/components/_index.sass b/app/components/_index.sass
index df5d51df72f..b4e2a24b82f 100644
--- a/app/components/_index.sass
+++ b/app/components/_index.sass
@@ -2,6 +2,6 @@
@import "work_packages/share/invite_user_form_component"
@import "work_packages/progress/modal_body_component"
@import "open_project/common/attribute_component"
-@import "filters_component"
+@import "filter/filters_component"
@import "projects/settings/project_custom_field_sections/index_component"
@import "projects/row_component"
diff --git a/app/components/filter/filter_button_component.html.erb b/app/components/filter/filter_button_component.html.erb
new file mode 100644
index 00000000000..adb27dba4aa
--- /dev/null
+++ b/app/components/filter/filter_button_component.html.erb
@@ -0,0 +1,8 @@
+<%= render(Primer::Beta::Button.new(scheme: :secondary,
+ disabled:,
+ data: { "filters-target": "filterFormToggle",
+ action: "filters#toggleDisplayFilters" },
+ test_selector: "filter-component-toggle")) do |button| %>
+ <% button.with_trailing_visual_counter(count: filters_count) %>
+ <%= t(:label_filter) %>
+<% end %>
diff --git a/app/components/filter/filter_button_component.rb b/app/components/filter/filter_button_component.rb
new file mode 100644
index 00000000000..e884b254dcb
--- /dev/null
+++ b/app/components/filter/filter_button_component.rb
@@ -0,0 +1,41 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+module Filter
+ # rubocop:disable OpenProject/AddPreviewForViewComponent
+ class FilterButtonComponent < ApplicationComponent
+ # rubocop:enable OpenProject/AddPreviewForViewComponent
+ options :query
+ options :disabled
+
+ def filters_count
+ @filters_count ||= query.filters.count
+ end
+ end
+end
diff --git a/app/components/filter/filter_component.html.erb b/app/components/filter/filter_component.html.erb
new file mode 100644
index 00000000000..5507942ea86
--- /dev/null
+++ b/app/components/filter/filter_component.html.erb
@@ -0,0 +1,127 @@
+<%= form_tag({},
+ method: :get,
+ class: "op-filters-form op-filters-form_top-margin #{show_filters_section? ? "-expanded" : ""}",
+ data: {
+ 'filters-target': 'filterForm',
+ action: 'submit->filters#sendForm:prevent'
+ }) do %>
+ <% operators_without_values = %w[* !* t w] %>
+ <fieldset class="advanced-filters--container">
+ <a title="<%= t('js.close_form_title') %>"
+ class="advanced-filters--close icon-context icon-close"
+ data-action="filters#toggleDisplayFilters"></a>
+ <legend><%= t(:label_filter_plural) %></legend>
+ <ul class="advanced-filters--filters">
+ <% each_filter do |filter, filter_active, additional_options| %>
+ <% filter_boolean = filter.is_a?(Queries::Filters::Shared::BooleanFilter) %>
+ <% autocomplete_filter = additional_options.key?(:autocomplete_options) %>
+
+ <li class="advanced-filters--filter <%= filter_active ? '' : 'hidden' %>"
+ filter-name="<%= filter.name %>"
+ filter-type="<%= filter.type %>"
+ data-filters-target="filter">
+ <label class='advanced-filters--filter-name' for="<%= filter.name %>">
+ <%= filter.human_name %>
+ </label>
+ <% selected_operator = filter.operator || filter.default_operator.symbol %>
+ <%= content_tag :div, class: "advanced-filters--filter-operator", style: filter_boolean ? 'display:none' : '' do %>
+ <%= select_tag :operator,
+ options_from_collection_for_select(
+ filter.available_operators,
+ :symbol,
+ :human_name,
+ selected_operator),
+ class: 'advanced-filters--select',
+ data: {
+ action: 'change->filters#setValueVisibility',
+ 'filters-filter-name-param': filter.name,
+ 'filters-target': 'operator',
+ 'filter-name': filter.name
+ } %>
+ <% end %>
+ <% value_visibility = operators_without_values.include?(selected_operator) ? 'hidden' : '' %>
+ <% if autocomplete_filter %>
+ <%= render partial: 'filters/autocomplete',
+ locals: { value_visibility: value_visibility,
+ filter: filter,
+ autocomplete_options: additional_options[:autocomplete_options] } %>
+ <% elsif filter_boolean %>
+ <%= render partial: 'filters/boolean',
+ locals: { value_visibility: value_visibility,
+ filter: filter } %>
+ <% elsif %i(list list_optional list_all).include? filter.type %>
+ <%= render partial: 'filters/list/input_options',
+ locals: { value_visibility: value_visibility,
+ filter: filter } %>
+ <% elsif [:datetime_past, :date].include? filter.type %>
+ <%= render partial: 'filters/date/input_options',
+ locals: { value_visibility: value_visibility,
+ filter: filter,
+ selected_operator: selected_operator } %>
+ <% else %>
+ <%# All other simple types %>
+ <%= render partial: 'filters/text',
+ locals: { value_visibility: value_visibility,
+ filter: filter } %>
+ <% end %>
+
+ <div class="advanced-filters--remove-filter">
+ <a href="#"
+ class="filter_rem"
+ data-action="click->filters#removeFilter"
+ data-filters-filter-name-param="<%= filter.name %>">
+ <%= helpers.op_icon("icon-close advanced-filters--remove-filter-icon", title: I18n.t('js.button_delete')) %>
+ </a>
+ </div>
+ </li>
+ <% end %>
+
+ <li class="advanced-filters--spacer <%= query.filters.blank? ? 'hidden' : '' %>"
+ data-filters-target="spacer"></li>
+
+ <li class="advanced-filters--add-filter">
+ <!-- Add filters -->
+ <label for="add_filter_select" aria-hidden="true" class="advanced-filters--add-filter-label ng-binding">
+ <%= helpers.op_icon("icon-add icon4") %>
+ <%= t(:label_filter_add) %>:
+ </label>
+ <label for="add_filter_select" class="hidden-for-sighted ng-binding">
+ <%= t(:label_filter_add) %>
+ <%= t('js.filter.description.text_open_filter') %>
+ <%= t('js.filter.description.text_close_filter') %>
+ </label>
+
+ <div class="advanced-filters--add-filter-value">
+ <%= select_tag 'add_filter_select',
+ options_from_collection_for_select(
+ allowed_filters,
+ :name,
+ :human_name,
+ disabled: query.filters.map(&:name)
+ ),
+ prompt: t(:actionview_instancetag_blank_option),
+ class: 'advanced-filters--select',
+ focus: "false",
+ 'aria-invalid': "false",
+ data: {
+ 'filters-target': 'addFilterSelect',
+ action: 'change->filters#addFilter:prevent'
+ } %>
+ </div>
+ </li>
+ <li class="advanced-filters--controls">
+ <%= submit_tag t('button_apply'), class: 'button -small -primary', name: nil %>
+ </li>
+ </ul>
+ <% unless EnterpriseToken.allows_to?(:custom_fields_in_projects_list)%>
+ <%=
+ helpers.angular_component_tag 'op-enterprise-banner',
+ inputs: {
+ collapsible: true,
+ textMessage: t('ee.upsale.project_filters.description_html'),
+ moreInfoLink: OpenProject::Static::Links.links[:enterprise_docs][:custom_field_projects][:href],
+ }
+ %>
+ <% end %>
+ </fieldset>
+<% end %>
diff --git a/app/components/filter/filter_component.rb b/app/components/filter/filter_component.rb
new file mode 100644
index 00000000000..077f3b54dd8
--- /dev/null
+++ b/app/components/filter/filter_component.rb
@@ -0,0 +1,83 @@
+# frozen_string_literal: true
+
+# -- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2010-2023 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+# ++
+module Filter
+ # rubocop:disable OpenProject/AddPreviewForViewComponent
+ class FilterComponent < ApplicationComponent
+ # rubocop:enable OpenProject/AddPreviewForViewComponent
+ options :query
+ options hide_initially: false
+
+ def show_filters_section?
+ !hide_initially || (params[:filters].present? && !params.key?(:hide_filters_section))
+ end
+
+ # Returns filters, active and inactive.
+ # In case a filter is active, the active one will be preferred over the inactive one.
+ def each_filter
+ allowed_filters.each do |filter|
+ active_filter = query.find_active_filter(filter.name)
+ additional_attributes = additional_filter_attributes(filter)
+
+ yield active_filter.presence || filter, active_filter.present?, additional_attributes
+ end
+ end
+
+ def allowed_filters
+ query
+ .available_filters
+ end
+
+ 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
+ {
+ autocomplete_options: {
+ component: "opce-project-autocompleter",
+ resource: "projects",
+ filters: [
+ { name: "active", operator: "=", values: ["t"] }
+ ]
+ }
+ }
+ else
+ {}
+ end
+ end
+ end
+end
diff --git a/app/components/filters_component.sass b/app/components/filter/filters_component.sass
similarity index 88%
rename from app/components/filters_component.sass
rename to app/components/filter/filters_component.sass
index b2d7bf64a8b..6e7856e6301 100644
--- a/app/components/filters_component.sass
+++ b/app/components/filter/filters_component.sass
@@ -43,10 +43,5 @@
.advanced-filters--controls
margin-top: 1rem
- &-header
- display: flex
- justify-content: space-between
- margin-bottom: 1rem
-
- &-actions
- display: flex
\ No newline at end of file
+ &_top-margin
+ margin-top: 1rem
diff --git a/app/components/filters_component.html.erb b/app/components/filters_component.html.erb
deleted file mode 100644
index 58b2547b135..00000000000
--- a/app/components/filters_component.html.erb
+++ /dev/null
@@ -1,153 +0,0 @@
-<div data-controller="filters"
- data-application-target="dynamic"
- data-filters-output-format-value="<%= output_format %>"
- data-filters-display-filters-value="<%= show_filters_section? %>">
-
- <div class="op-filters-header">
- <%= render(Primer::Beta::Button.new(
- scheme: :secondary,
- disabled:,
- data: { 'filters-target': 'filterFormToggle',
- 'action': 'filters#toggleDisplayFilters',
- 'test-selector': 'filter-component-toggle' })) do %>
- <%= t(:label_filter) %>
- <%= render(Primer::Beta::Counter.new(count: filters_count,
- round: true,
- hide_if_zero: false,
- scheme: :default,
- test_selector: "filters-button-counter" )) %>
- <% end %>
- <div class="op-filters-header-actions">
- <% buttons.each do |button| %>
- <%= button %>
- <% end %>
- </div>
- </div>
- <%= form_tag({},
- method: :get,
- class: "op-filters-form",
- data: {
- 'filters-target': 'filterForm',
- action: 'submit->filters#sendForm:prevent'
- }) do %>
- <% operators_without_values = %w[* !* t w] %>
- <fieldset class="advanced-filters--container">
- <a title="<%= t('js.close_form_title') %>"
- class="advanced-filters--close icon-context icon-close"
- data-action="filters#toggleDisplayFilters"></a>
- <legend><%= t(:label_filter_plural) %></legend>
- <ul class="advanced-filters--filters">
- <% each_filter do |filter, filter_active, additional_options| %>
- <% filter_boolean = filter.is_a?(Queries::Filters::Shared::BooleanFilter) %>
- <% autocomplete_filter = additional_options.key?(:autocomplete_options) %>
-
- <li class="advanced-filters--filter <%= filter_active ? '' : 'hidden' %>"
- filter-name="<%= filter.name %>"
- filter-type="<%= filter.type %>"
- data-filters-target="filter">
- <label class='advanced-filters--filter-name' for="<%= filter.name %>">
- <%= filter.human_name %>
- </label>
- <% selected_operator = filter.operator || filter.default_operator.symbol %>
- <%= content_tag :div, class: "advanced-filters--filter-operator", style: filter_boolean ? 'display:none' : '' do %>
- <%= select_tag :operator,
- options_from_collection_for_select(
- filter.available_operators,
- :symbol,
- :human_name,
- selected_operator),
- class: 'advanced-filters--select',
- data: {
- action: 'change->filters#setValueVisibility',
- 'filters-filter-name-param': filter.name,
- 'filters-target': 'operator',
- 'filter-name': filter.name
- } %>
- <% end %>
- <% value_visibility = operators_without_values.include?(selected_operator) ? 'hidden' : '' %>
- <% if autocomplete_filter %>
- <%= render partial: 'filters/autocomplete',
- locals: { value_visibility: value_visibility,
- filter: filter,
- autocomplete_options: additional_options[:autocomplete_options] } %>
- <% elsif filter_boolean %>
- <%= render partial: 'filters/boolean',
- locals: { value_visibility: value_visibility,
- filter: filter } %>
- <% elsif %i(list list_optional list_all).include? filter.type %>
- <%= render partial: 'filters/list/input_options',
- locals: { value_visibility: value_visibility,
- filter: filter } %>
- <% elsif [:datetime_past, :date].include? filter.type %>
- <%= render partial: 'filters/date/input_options',
- locals: { value_visibility: value_visibility,
- filter: filter,
- selected_operator: selected_operator } %>
- <% else %>
- <%# All other simple types %>
- <%= render partial: 'filters/text',
- locals: { value_visibility: value_visibility,
- filter: filter } %>
- <% end %>
-
- <div class="advanced-filters--remove-filter">
- <a href="#"
- class="filter_rem"
- data-action="click->filters#removeFilter"
- data-filters-filter-name-param="<%= filter.name %>">
- <%= helpers.op_icon("icon-close advanced-filters--remove-filter-icon", title: I18n.t('js.button_delete')) %>
- </a>
- </div>
- </li>
- <% end %>
-
- <li class="advanced-filters--spacer <%= query.filters.blank? ? 'hidden' : '' %>"
- data-filters-target="spacer"></li>
-
- <li class="advanced-filters--add-filter">
- <!-- Add filters -->
- <label for="add_filter_select" aria-hidden="true" class="advanced-filters--add-filter-label ng-binding">
- <%= helpers.op_icon("icon-add icon4") %>
- <%= t(:label_filter_add) %>:
- </label>
- <label for="add_filter_select" class="hidden-for-sighted ng-binding">
- <%= t(:label_filter_add) %>
- <%= t('js.filter.description.text_open_filter') %>
- <%= t('js.filter.description.text_close_filter') %>
- </label>
-
- <div class="advanced-filters--add-filter-value">
- <%= select_tag 'add_filter_select',
- options_from_collection_for_select(
- allowed_filters,
- :name,
- :human_name,
- disabled: query.filters.map(&:name)
- ),
- prompt: t(:actionview_instancetag_blank_option),
- class: 'advanced-filters--select',
- focus: "false",
- 'aria-invalid': "false",
- data: {
- 'filters-target': 'addFilterSelect',
- action: 'change->filters#addFilter:prevent'
- } %>
- </div>
- </li>
- <li class="advanced-filters--controls">
- <%= submit_tag t('button_apply'), class: 'button -small -primary', name: nil %>
- </li>
- </ul>
- <% unless EnterpriseToken.allows_to?(:custom_fields_in_projects_list)%>
- <%=
- helpers.angular_component_tag 'op-enterprise-banner',
- inputs: {
- collapsible: true,
- textMessage: t('ee.upsale.project_filters.description_html'),
- moreInfoLink: OpenProject::Static::Links.links[:enterprise_docs][:custom_field_projects][:href],
- }
- %>
- <% end %>
- </fieldset>
- <% end %>
-</div>
diff --git a/app/components/filters_component.rb b/app/components/filters_component.rb
deleted file mode 100644
index c4e4404cb8a..00000000000
--- a/app/components/filters_component.rb
+++ /dev/null
@@ -1,90 +0,0 @@
-# frozen_string_literal: true
-
-# -- copyright
-# OpenProject is an open source project management software.
-# Copyright (C) 2010-2023 the OpenProject GmbH
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License version 3.
-#
-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-# Copyright (C) 2006-2013 Jean-Philippe Lang
-# Copyright (C) 2010-2013 the ChiliProject Team
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# See COPYRIGHT and LICENSE files for more details.
-# ++
-
-class FiltersComponent < ApplicationComponent
- options :query
- options :disabled
- options output_format: "params"
-
- renders_many :buttons, lambda { |**system_arguments|
- system_arguments[:ml] ||= 2
- Primer::Beta::Button.new(**system_arguments)
- }
-
- def show_filters_section?
- params[:filters].present? && !params.key?(:hide_filters_section)
- end
-
- # Returns filters, active and inactive.
- # In case a filter is active, the active one will be preferred over the inactive one.
- def each_filter
- allowed_filters.each do |filter|
- active_filter = query.find_active_filter(filter.name)
- additional_attributes = additional_filter_attributes(filter)
-
- yield active_filter.presence || filter, active_filter.present?, additional_attributes
- end
- end
-
- def allowed_filters
- query
- .available_filters
- end
-
- def filters_count
- @filters_count ||= query.filters.count
- end
-
- 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
- {
- autocomplete_options: {
- component: "opce-project-autocompleter",
- resource: "projects",
- filters: [
- { name: "active", operator: "=", values: ["t"] }
- ]
- }
- }
- else
- {}
- end
- end
-end
diff --git a/app/components/projects/projects_filters_component.rb b/app/components/projects/projects_filters_component.rb
index 450e2545aa7..e467c186dd1 100644
--- a/app/components/projects/projects_filters_component.rb
+++ b/app/components/projects/projects_filters_component.rb
@@ -28,7 +28,9 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
-class Projects::ProjectsFiltersComponent < FiltersComponent
+# rubocop:disable OpenProject/AddPreviewForViewComponent
+class Projects::ProjectsFiltersComponent < Filter::FilterComponent
+ # rubocop:enable OpenProject/AddPreviewForViewComponent
def allowed_filters
super
.select { |f| allowed_filter?(f) }
diff --git a/lookbook/previews/open_project/common/filters_component_preview.rb b/lookbook/previews/open_project/common/filters_component_preview.rb
deleted file mode 100644
index 2050984ab68..00000000000
--- a/lookbook/previews/open_project/common/filters_component_preview.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-module OpenProject
- module Common
- # @logical_path OpenProject/Common
- class FiltersComponentPreview < Lookbook::Preview
- def default
- @query = Queries::Projects::ProjectQuery.new
- render(Projects::ProjectsFiltersComponent.new(query: @query)) do |component|
- component.with_button(
- tag: :a,
- href: "",
- scheme: :primary,
- size: :medium,
- aria: { label: I18n.t(:label_project_new) },
- data: { "test-selector": "project-new-button" }
- ) do |button|
- button.with_leading_visual_icon(icon: :plus)
- Project.model_name.human
- end
- end
- end
- end
- end
-end
diff --git a/lookbook/previews/open_project/filter/filter_button_component_preview.rb b/lookbook/previews/open_project/filter/filter_button_component_preview.rb
new file mode 100644
index 00000000000..b16455531d6
--- /dev/null
+++ b/lookbook/previews/open_project/filter/filter_button_component_preview.rb
@@ -0,0 +1,20 @@
+module OpenProject
+ module Filter
+ # @logical_path OpenProject/Filter
+ class FilterButtonComponentPreview < Lookbook::Preview
+ def default
+ @query = Queries::Projects::ProjectQuery.new
+ render(::Filter::FilterButtonComponent.new(query: @query))
+ end
+
+ # @label With toggable filter section
+ # There is a stimulus controller, which can toggle the visibility of an FilterComponent with the help of a FilterButton.
+ # Just register the controller in a container around both elements.
+ # Unfortunately, stimulus controllers do not work in our lookbook as of now, so you will see no effect.
+ def filter_section_toggle
+ @query = Queries::Projects::ProjectQuery.new
+ render_with_template(locals: { query: @query })
+ end
+ end
+ end
+end
diff --git a/lookbook/previews/open_project/filter/filter_button_component_preview/filter_section_toggle.html.erb b/lookbook/previews/open_project/filter/filter_button_component_preview/filter_section_toggle.html.erb
new file mode 100644
index 00000000000..96432346e2e
--- /dev/null
+++ b/lookbook/previews/open_project/filter/filter_button_component_preview/filter_section_toggle.html.erb
@@ -0,0 +1,7 @@
+<div data-controller="filters"
+ data-application-target="dynamic"
+ data-filters-display-filters-value="false"
+ data-filters-output-format-value="params">
+ <%= render ::Filter::FilterButtonComponent.new(query: query) %>
+ <%= render Projects::ProjectsFiltersComponent.new(query: query) %>
+</div>
diff --git a/lookbook/previews/open_project/filter/filters_component_preview.rb b/lookbook/previews/open_project/filter/filters_component_preview.rb
new file mode 100644
index 00000000000..13646dc4fcb
--- /dev/null
+++ b/lookbook/previews/open_project/filter/filters_component_preview.rb
@@ -0,0 +1,11 @@
+module OpenProject
+ module Filter
+ # @logical_path OpenProject/Filter
+ class FiltersComponentPreview < Lookbook::Preview
+ def default
+ @query = Queries::Projects::ProjectQuery.new
+ render(Projects::ProjectsFiltersComponent.new(query: @query))
+ end
+ end
+ end
+end
diff --git a/modules/meeting/app/components/meetings/meeting_filters_component.rb b/modules/meeting/app/components/meetings/meeting_filters_component.rb
index 987425ad05d..03cef407932 100644
--- a/modules/meeting/app/components/meetings/meeting_filters_component.rb
+++ b/modules/meeting/app/components/meetings/meeting_filters_component.rb
@@ -28,7 +28,9 @@
# See COPYRIGHT and LICENSE files for more details.
# ++
module Meetings
- class MeetingFiltersComponent < FiltersComponent
+ # rubocop:disable OpenProject/AddPreviewForViewComponent
+ class MeetingFiltersComponent < Filter::FilterComponent
+ # rubocop:enable OpenProject/AddPreviewForViewComponent
options :project
def allowed_filters