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
Move wrapper element to menu helper
Oliver Güntherbfaebd6a3f38
diff --git a/frontend/src/app/core/main-menu/main-menu-navigation.service.ts b/frontend/src/app/core/main-menu/main-menu-navigation.service.tsindex f1d492e31b2..7e89d4b2476 100644--- a/frontend/src/app/core/main-menu/main-menu-navigation.service.ts+++ b/frontend/src/app/core/main-menu/main-menu-navigation.service.ts@@ -51,7 +51,7 @@ export class MainMenuNavigationService {const item = mainItems[index];const elementId = item.id;- const wrapperElement = jQuery('<div class="main-item-wrapper"/>');+ const wrapperElement = jQuery('<div class=""/>');// inherit element idif (elementId) {@@ -64,7 +64,7 @@ export class MainMenuNavigationService {register() {// Wrap main item- this.wrapMainItem();+ //this.wrapMainItem();// Scroll to the active item or if none found, the active menu wrapperconst selected = document.querySelector('.tree-menu--item.-selected')diff --git a/lib/redmine/menu_manager/menu_helper.rb b/lib/redmine/menu_manager/menu_helper.rbindex 8901f1e7ee1..033fe1633a8 100644--- a/lib/redmine/menu_manager/menu_helper.rb+++ b/lib/redmine/menu_manager/menu_helper.rb@@ -131,37 +131,43 @@ module Redmine::MenuManager::MenuHelper# rubocop:disable Metrics/AbcSizedef render_menu_node_with_children(node, project = nil)- html_options = { data: { name: node.name } }+ content_tag :li, menu_node_options(node) do+ items = [+ render_wrapped_menu_node(node, project),+ render_visible_children_list(node, project),+ render_unattached_children_list(node, project)+ ]++ safe_join(items, "\n")+ end+ end+ # rubocop:enable Metrics/AbcSize- if node_or_children_selected?(node)- html_options[:class] = 'open'+ def render_wrapped_menu_node(node, project)+ html_id = node.html_options[:id] || node.name+ content_tag(:div, class: 'main-item-wrapper', id: "#{html_id}-wrapper") do+ render_single_menu_node(node, project)end- content_tag :li, html_options do- # Standard children- standard_children_list = node.children.map do |child|- render_menu_node(child, project) if visible_node?(@menu, child)- end.join.html_safe+ end- # Unattached children- unattached_children_list = render_unattached_children_menu(node, project)+ def render_visible_children_list(node, project)+ items = node+ .children+ .map { |child| render_menu_node(child, project) if visible_node?(@menu, child) }- # Parent- node = [render_single_menu_node(node, project)]+ if items.present?+ content_tag(:ul, safe_join(items, "\n"), class: 'main-menu--children')+ end+ end- # add children- unless standard_children_list.empty?- node << content_tag(:ul, standard_children_list, class: 'main-menu--children')- end- if unattached_children_list.present?- node << content_tag(:ul, unattached_children_list, class: 'main-menu--children unattached')- end+ def render_unattached_children_list(node, project)+ items = render_unattached_children_menu(node, project)- safe_join(node, "\n")+ if items.present?+ content_tag(:ul, items, class: 'main-menu--children unattached')endend- # rubocop:enable Metrics/AbcSize-# rubocop:disable Metrics/AbcSizedef render_single_menu_node(item, project = nil, menu_class = 'op-menu')caption, url, selected = extract_node_details(item, project)@@ -210,6 +216,15 @@ module Redmine::MenuManager::MenuHelperprivate+ def menu_node_options(node)+ html_options = { data: { name: node.name } }++ if node_or_children_selected?(node)+ html_options[:class] = 'open'+ end+ html_options+ end+# Returns a list of unattached children menu itemsdef render_unattached_children_menu(node, project)return nil unless node.child_menus