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

moving show-filters method to the filters controller from projects helper

Behrokh Satarnejad80c963ce57ae
diff --git a/app/components/filters_component.html.erb b/app/components/filters_component.html.erb
index b9bd38766df..e0a8b738dfc 100644
--- a/app/components/filters_component.html.erb
+++ b/app/components/filters_component.html.erb
@@ -1,6 +1,6 @@
<div data-controller="filters"
data-application-target="dynamic"
- data-filters-display-filters-value="<%= helpers.show_filters_section? %>">
+ data-filters-display-filters-value="<%= show_filters_section? %>">
<div class="op-filters-header">
<%= render(Primer::Beta::Button.new(
diff --git a/app/components/filters_component.rb b/app/components/filters_component.rb
index 4e9090f242c..c08ff7b4948 100644
--- a/app/components/filters_component.rb
+++ b/app/components/filters_component.rb
@@ -30,17 +30,21 @@
class FiltersComponent < ApplicationComponent
options :query
-
+
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
+
def allowed_filters
query
.available_filters
end
-
+
def filters_count
query.filters.count
end
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 693d77967ac..923fcae521f 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -29,10 +29,6 @@
module ProjectsHelper
include WorkPackagesFilterHelper
- def show_filters_section?
- params[:filters].present? && !params.key?(:hide_filters_section)
- end
-
def no_projects_result_box_params
if User.current.allowed_globally?(:add_project)
{ action_url: new_project_path, display_action: true }
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index 8e189ba4ded..fab7a7bcd94 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -29,8 +29,7 @@ See COPYRIGHT and LICENSE files for more details.
<% html_title(t(:label_project_plural)) -%>
<div data-controller="project"
- data-application-target="dynamic"
- data-project-display-filters-value="<%= show_filters_section? %>">
+ data-application-target="dynamic">
<%= render Projects::IndexPageHeaderComponent.new(
projects: @projects,
query: @query,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index cae6cc85dca..c099e7dc823 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -1915,8 +1915,7 @@ en:
label_feeds_access_key_type: "RSS"
label_file_plural: "Files"
label_filter_add: "Add filter"
- label_filter: "Filter"
- label_filter_by_text: "Filter by text"
+ label_filter: "Filters"
label_filter_plural: "Filters"
label_filters_toggle: "Show/hide filters"
label_float: "Float"