summaryrefslogtreecommitdiff
path: root/lib/sidebars/groups/menus/scope_menu.rb
blob: 6ce43491343b444042c04fdc1dfbb0fb7efc1449 (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
# frozen_string_literal: true

module Sidebars
  module Groups
    module Menus
      class ScopeMenu < ::Sidebars::Menu
        override :link
        def link
          group_path(context.group)
        end

        override :title
        def title
          context.group.name
        end

        override :active_routes
        def active_routes
          { path: %w[groups#show groups#details] }
        end

        override :extra_nav_link_html_options
        def extra_nav_link_html_options
          {
            class: 'context-header has-tooltip',
            title: context.group.name,
            data: { container: 'body', placement: 'right' }
          }
        end

        override :render?
        def render?
          true
        end
      end
    end
  end
end