debian-mirror-gitlab/lib/sidebars/projects/menus/learn_gitlab_menu.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.3 KiB
Ruby
Raw Normal View History

2021-06-08 01:23:25 +05:30
# 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?
2021-11-11 11:23:49 +05:30
context.learn_gitlab_enabled
2021-06-08 01:23:25 +05:30
end
override :pill_count
def pill_count
strong_memoize(:pill_count) do
2022-08-13 15:12:31 +05:30
percentage = LearnGitlab::Onboarding.new(
context.project.namespace,
context.current_user
).completed_percentage
2021-06-08 01:23:25 +05:30
"#{percentage}%"
end
end
2021-09-04 01:27:46 +05:30
override :extra_nav_link_html_options
def extra_nav_link_html_options
2021-06-08 01:23:25 +05:30
{
class: 'home',
data: {
2021-11-11 11:23:49 +05:30
track_label: 'learn_gitlab'
2021-06-08 01:23:25 +05:30
}
}
end
2022-06-21 17:19:12 +05:30
override :sprite_icon
def sprite_icon
'bulb'
2021-06-08 01:23:25 +05:30
end
override :render?
def render?
2021-11-11 11:23:49 +05:30
context.learn_gitlab_enabled
2021-06-08 01:23:25 +05:30
end
end
end
end
end