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 a new method to fetch the number of filters and remove unnecessary margin

Behrokh Satarnejad4a4cafad9698
diff --git a/app/components/filters_component.html.erb b/app/components/filters_component.html.erb
index dd5f6ab84f3..b9bd38766df 100644
--- a/app/components/filters_component.html.erb
+++ b/app/components/filters_component.html.erb
@@ -5,13 +5,11 @@
<div class="op-filters-header">
<%= render(Primer::Beta::Button.new(
scheme: :secondary,
- mb: 2,
- mr: 2,
data: { 'filters-target': 'filterFormToggle',
'action': 'filters#toggleDisplayFilters',
'test-selector': 'project-filter-toggle' })) do %>
<%= t(:label_filter) %>
- <%= render(Primer::Beta::Counter.new(count: query.filters.count, round: true, hide_if_zero: false, scheme: :default)) %>
+ <%= render(Primer::Beta::Counter.new(count: filters_count, round: true, hide_if_zero: false, scheme: :default)) %>
<% end %>
<div class="op-filters-header-actions">
<% buttons.each do |button| %>
diff --git a/app/components/filters_component.rb b/app/components/filters_component.rb
index 8e0fac8b18e..4e9090f242c 100644
--- a/app/components/filters_component.rb
+++ b/app/components/filters_component.rb
@@ -40,4 +40,8 @@ class FiltersComponent < ApplicationComponent
query
.available_filters
end
+
+ def filters_count
+ query.filters.count
+ end
end