blob: e3fcd8f25d553f352f7acac1fdcceeac99e4ab7e (
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
|
# frozen_string_literal: true
module Sidebars
module Projects
module Menus
class LearnGitlabMenu < ::Sidebars::Menu
include Gitlab::Utils::StrongMemoize
override :link
def link
project_learn_gitlab_path(context.project)
end
override :active_routes
def active_routes
{ controller: :learn_gitlab }
end
override :title
def title
_('Learn GitLab')
end
override :has_pill?
def has_pill?
context.learn_gitlab_experiment_enabled
end
override :pill_count
def pill_count
strong_memoize(:pill_count) do
percentage = LearnGitlab::Onboarding.new(context.project.namespace).completed_percentage
"#{percentage}%"
end
end
override :extra_container_html_options
def nav_link_html_options
{
class: 'home',
data: {
track_action: 'click_menu',
track_property: context.learn_gitlab_experiment_tracking_category,
track_label: 'learn_gitlab'
}
}
end
override :image_path
def image_path
'learn_gitlab/graduation_hat.svg'
end
override :render?
def render?
context.learn_gitlab_experiment_enabled
end
end
end
end
end
|