blob: ae4fd6b02e76817bbafb28fc18995f478ee4cc56 (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# frozen_string_literal: true
module Sidebars
module Projects
module Menus
class MergeRequestsMenu < ::Sidebars::Menu
override :link
def link
project_merge_requests_path(context.project)
end
override :extra_container_html_options
def extra_container_html_options
{
class: 'shortcuts-merge_requests'
}
end
override :title
def title
_('Merge requests')
end
override :title_html_options
def title_html_options
{
id: 'js-onboarding-mr-link'
}
end
override :sprite_icon
def sprite_icon
'git-merge'
end
override :render?
def render?
can?(context.current_user, :read_merge_request, context.project) &&
context.project.repo_exists?
end
override :has_pill?
def has_pill?
true
end
override :pill_count
def pill_count
count = @pill_count ||= context.project.open_merge_requests_count
format_cached_count(1000, count)
end
override :pill_html_options
def pill_html_options
{
class: 'merge_counter js-merge-counter'
}
end
override :active_routes
def active_routes
if context.project.issues_enabled?
{ controller: ['projects/merge_requests', :conflicts] }
else
{ controller: ['projects/merge_requests', :milestones, :conflicts] }
end
end
override :serialize_as_menu_item_args
def serialize_as_menu_item_args
super.merge({
pill_count: pill_count,
has_pill: has_pill?,
super_sidebar_parent: ::Sidebars::Projects::SuperSidebarMenus::CodeMenu,
item_id: :project_merge_request_list
})
end
end
end
end
end
|