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

menu.rb « repository « menus « projects « sidebars « models « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f49a0479521481a5372d9cc28f3af41186835481 (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
51
52
53
54
55
56
57
58
59
# frozen_string_literal: true

module Sidebars
  module Projects
    module Menus
      module Repository
        class Menu < ::Sidebars::Menu
          override :configure_menu_items
          def configure_menu_items
            add_item(MenuItems::Files.new(context))
            add_item(MenuItems::Commits.new(context))
            add_item(MenuItems::Branches.new(context))
            add_item(MenuItems::Tags.new(context))
            add_item(MenuItems::Contributors.new(context))
            add_item(MenuItems::Graphs.new(context))
            add_item(MenuItems::Compare.new(context))
          end

          override :link
          def link
            project_tree_path(context.project)
          end

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

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

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

          override :sprite_icon
          def sprite_icon
            'doc-text'
          end

          override :render?
          def render?
            can?(context.current_user, :download_code, context.project) &&
              !context.project.empty_repo?
          end
        end
      end
    end
  end
end

Sidebars::Projects::Menus::Repository::Menu.prepend_if_ee('EE::Sidebars::Projects::Menus::Repository::Menu')