summaryrefslogtreecommitdiff
path: root/lib/sidebars/projects/menus/labels_menu.rb
blob: 12cf04449943d55563e42146750cdd2ada1fa024 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# frozen_string_literal: true

module Sidebars
  module Projects
    module Menus
      class LabelsMenu < ::Sidebars::Menu
        override :link
        def link
          project_labels_path(context.project)
        end

        override :extra_container_html_options
        def extra_container_html_options
          {
            class: 'shortcuts-labels'
          }
        end

        override :title
        def title
          _('Labels')
        end

        override :title_html_options
        def title_html_options
          {
            id: 'js-onboarding-labels-link'
          }
        end

        override :active_routes
        def active_routes
          { controller: :labels }
        end

        override :sprite_icon
        def sprite_icon
          'label'
        end

        override :render?
        def render?
          return false if Feature.enabled?(:sidebar_refactor, context.current_user)

          can?(context.current_user, :read_label, context.project) && !context.project.issues_enabled?
        end
      end
    end
  end
end