Welcome to mirror list, hosted at ThFree Co, Russian Federation.

work_item_hierarchy.rb « concerns « sidebars « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a4153bb512051757740b988bd0f6549428ce74d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

# This module has the necessary methods to render
# work items hierarchy menu
module Sidebars
  module Concerns
    module WorkItemHierarchy
      def hierarchy_menu_item(container, url, path)
        unless show_hierarachy_menu_item?(container)
          return ::Sidebars::NilMenuItem.new(item_id: :hierarchy)
        end

        ::Sidebars::MenuItem.new(
          title: _('Planning hierarchy'),
          link: url,
          active_routes: { path: path },
          item_id: :hierarchy
        )
      end

      def show_hierarachy_menu_item?(container)
        can?(context.current_user, :read_planning_hierarchy, container)
      end
    end
  end
end