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
[#52147] remove unnecessary helper method
Tobias Dillmannd3efcf3212ac
diff --git a/app/components/projects/table_component.rb b/app/components/projects/table_component.rbindex 751645cd2fb..e8265938581 100644--- a/app/components/projects/table_component.rb+++ b/app/components/projects/table_component.rb@@ -64,7 +64,7 @@ module Projects### The project sort by is handled differentlydef build_sort_header(column, options)- helpers.projects_sort_header_tag(column, **options, param: :json)+ helpers.projects_sort_header_tag(column, query.selects.map(&:attribute), **options, param: :json)end# We don't return the project rowdiff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rbindex 7f9804d2816..e508d83b4b9 100644--- a/app/helpers/projects_helper.rb+++ b/app/helpers/projects_helper.rb@@ -40,12 +40,12 @@ module ProjectsHelper# Just like sort_header tag but removes sorting by# lft from the sort criteria as lft is mutually exclusive with# the other criteria.- def projects_sort_header_tag(column, **)+ def projects_sort_header_tag(column, all_column_attributes, **)former_criteria = @sort_criteria.criteria.dup@sort_criteria.criteria.reject! { |a, _| a == "lft" }- sort_header_with_action_menu(column, PROJECTS_FILTER_FOR_COLUMN_MAPPING, **,+ sort_header_with_action_menu(column, all_column_attributes, PROJECTS_FILTER_FOR_COLUMN_MAPPING, **,allowed_params: projects_query_param_names_for_sort)ensure@sort_criteria.criteria = former_criteriadiff --git a/app/helpers/sort_helper.rb b/app/helpers/sort_helper.rbindex e1d21db01b5..dd673ca038d 100644--- a/app/helpers/sort_helper.rb+++ b/app/helpers/sort_helper.rb@@ -327,9 +327,9 @@ module SortHelper## This is a more specific version of #sort_header_tag.# For "filter by" to work properly, you must pass a Hash for `filter_column_mapping`.- def sort_header_with_action_menu(column, filter_column_mapping = {}, allowed_params: nil, **options)+ def sort_header_with_action_menu(column, all_columns, filter_column_mapping = {}, allowed_params: nil, **options)with_sort_header_options(column, allowed_params:, **options) do |col, cap, default_order, **opts|- action_menu(col, cap, default_order, filter_column_mapping, **opts)+ action_menu(col, all_columns, cap, default_order, filter_column_mapping, **opts)endend@@ -354,13 +354,6 @@ module SortHelperkey == :json ? :sortBy : :sortend- # FIXME: copied from ConfigureViewModalComponent- def selected_columns_for_action_menu- @selected_columns ||= @query- .selects- .map(&:attribute)- end-def build_columns_link(columns, allowed_params: nil, **html_options)sort_by = html_options.delete(:param)sort_key = sort_key(sort_by)@@ -386,10 +379,13 @@ module SortHelperfilter_mapping.fetch(col, col)end- def action_menu(column, caption, default_order, filter_column_mapping = {}, allowed_params: nil, **html_options)+ # Renders an ActionMenu for a specific column. The ActionMenu offers options such as sorting, moving a column to+ # the left or right, filtering by the column (not available for all columns) or removing it.+ # Some of the method arguments are only needed for specific actions.+ def action_menu(column, table_columns, caption, default_order, filter_column_mapping = {},+ allowed_params: nil, **html_options)caption ||= column.to_s.humanize- selected_columns = selected_columns_for_action_menufilter = find_filter_for_column(column, filter_column_mapping)# `param` is not needed in the `content_arguments`, but should remain in the `html_options`.@@ -404,8 +400,8 @@ module SortHelper# Some columns do not offer a filter. Only show the option when filtering is possible.filter_action(menu, filter, content_args:) if filter- move_column_actions(menu, column, selected_columns, content_args:, allowed_params:, **html_options)- add_and_remove_column_actions(menu, column, selected_columns, content_args:, allowed_params:, **html_options)+ move_column_actions(menu, column, table_columns, content_args:, allowed_params:, **html_options)+ add_and_remove_column_actions(menu, column, table_columns, content_args:, allowed_params:, **html_options)endend