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
Highlight selected tab when path matches and hide "items" tab for non hierachy fields
Henriette Darge9b4baa3e4322
diff --git a/app/components/admin/custom_fields/edit_form_header_component.rb b/app/components/admin/custom_fields/edit_form_header_component.rbindex 8a21e586e20..9490ed23340 100644--- a/app/components/admin/custom_fields/edit_form_header_component.rb+++ b/app/components/admin/custom_fields/edit_form_header_component.rb@@ -36,23 +36,30 @@ module Adminenddef tabs- [+ tabs = [{name: "edit",path: edit_custom_field_path(@custom_field),label: t(:label_details)- },- {+ }+ ]++ if @custom_field.field_format_hierarchy?+ tabs << {name: "items",path: custom_field_items_path(@custom_field),label: t(:label_item_plural)- },+ }+ end++ tabs <<{name: "custom_field_projects",path: custom_field_projects_path(@custom_field),label: t(:label_project_plural)}- ]++ tabsendprivatediff --git a/app/helpers/tabs_helper.rb b/app/helpers/tabs_helper.rbindex 7beb0f81f48..edd545f0335 100644--- a/app/helpers/tabs_helper.rb+++ b/app/helpers/tabs_helper.rb@@ -65,7 +65,11 @@ module TabsHelperenddef selected_tab(tabs)- tabs.detect { |t| t[:name].to_s == params[:tab].to_s } || tabs.first+ selected = tabs.detect { |t| t[:name].to_s == params[:tab].to_s } || tabs.detect { |t| current_page?(t[:path]) }++ return selected unless selected.nil?++ tabs.firstenddef tabs_for_key(key, params = {})diff --git a/app/helpers/types_helper.rb b/app/helpers/types_helper.rbindex 0d5a5a53cfa..e2618e00909 100644--- a/app/helpers/types_helper.rb+++ b/app/helpers/types_helper.rb@@ -29,7 +29,7 @@#++module ::TypesHelper- # rubocop:disable Rails/HelperInstanceVariable+ # rubocop:disable Rails/HelperInstanceVariable, Metrics/AbcSizedef types_tabstabs = [{@@ -73,7 +73,7 @@ module ::TypesHelpertabsend- # rubocop:enable Rails/HelperInstanceVariable+ # rubocop:enable Rails/HelperInstanceVariable, Metrics/AbcSizedef icon_for_type(type)return unless typediff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rbindex 744767772f2..ec64abd58a9 100644--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb@@ -44,7 +44,7 @@ module OpenProject::TwoFactorAuthenticationname: "two_factor_authentication",partial: "users/two_factor_authentication",path: ->(params) { edit_user_path(params[:user], tab: :two_factor_authentication) },- label: "two_factor_authentication.label_two_factor_authentication",+ label: :"two_factor_authentication.label_two_factor_authentication",only_if: ->(*) { User.current.admin? && OpenProject::TwoFactorAuthentication::TokenStrategyManager.enabled? }config.to_prepare do