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
Correctly check for filter params to decide whether the filter section should be opened
Henriette Darge6ba2f34e092d
diff --git a/app/components/filter/filter_button_component.html.erb b/app/components/filter/filter_button_component.html.erbindex adb27dba4aa..9f36eb0ba0e 100644--- a/app/components/filter/filter_button_component.html.erb+++ b/app/components/filter/filter_button_component.html.erb@@ -3,6 +3,6 @@data: { "filters-target": "filterFormToggle",action: "filters#toggleDisplayFilters" },test_selector: "filter-component-toggle")) do |button| %>- <% button.with_trailing_visual_counter(count: filters_count) %>+ <% button.with_trailing_visual_counter(count: filters_count, test_selector: "filters-button-counter") %><%= t(:label_filter) %><% end %>diff --git a/app/components/filter/filter_component.rb b/app/components/filter/filter_component.rbindex 077f3b54dd8..ea313e4d197 100644--- a/app/components/filter/filter_component.rb+++ b/app/components/filter/filter_component.rb@@ -32,10 +32,10 @@ module Filterclass FilterComponent < ApplicationComponent# rubocop:enable OpenProject/AddPreviewForViewComponentoptions :query- options hide_initially: false+ options always_visible: falsedef show_filters_section?- !hide_initially || (params[:filters].present? && !params.key?(:hide_filters_section))+ always_visible || params[:filters].present?end# Returns filters, active and inactive.diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erbindex 2bc845af85b..88c3662c188 100644--- a/app/views/projects/index.html.erb+++ b/app/views/projects/index.html.erb@@ -44,7 +44,6 @@ See COPYRIGHT and LICENSE files for more details.render(Primer::OpenProject::SubHeader.new(data: {controller: "filters","application-target": "dynamic",- "filters-display-filters-value": true, # TODO: show_filters_section?,})) do |subheader|subheader.with_filter_component dorender(Filter::FilterButtonComponent.new(query:))diff --git a/frontend/src/stimulus/controllers/dynamic/filters.controller.ts b/frontend/src/stimulus/controllers/dynamic/filters.controller.tsindex 50650a77a29..e6893ac7733 100644--- a/frontend/src/stimulus/controllers/dynamic/filters.controller.ts+++ b/frontend/src/stimulus/controllers/dynamic/filters.controller.ts@@ -72,6 +72,11 @@ export default class FiltersController extends Controller {declare displayFiltersValue:boolean;declare outputFormatValue:string;+ connect() {+ const urlParams = new URLSearchParams(window.location.search);+ this.displayFiltersValue = urlParams.has('filters');+ }+toggleDisplayFilters() {this.displayFiltersValue = !this.displayFiltersValue;}@@ -83,9 +88,9 @@ export default class FiltersController extends Controller {toggleButtonActive() {if (this.displayFiltersValue) {- this.filterFormToggleTarget.setAttribute('aria-disabled', 'true');+ this.filterFormToggleTarget.setAttribute('aria-pressed', 'true');} else {- this.filterFormToggleTarget.removeAttribute('aria-disabled');+ this.filterFormToggleTarget.removeAttribute('aria-pressed');}}diff --git a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb b/modules/meeting/app/components/meetings/index_sub_header_component.html.erbindex 2f8a63a3c77..5f8c67601e1 100644--- a/modules/meeting/app/components/meetings/index_sub_header_component.html.erb+++ b/modules/meeting/app/components/meetings/index_sub_header_component.html.erb@@ -1,7 +1,6 @@<%= render(Primer::OpenProject::SubHeader.new(data: {controller: "filters","application-target": "dynamic",- "filters-display-filters-value": false, # TODO: show_filters_section?,"filters-output-format-value": "json",})) do |subheader|subheader.with_filter_component do