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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sidebars/projects/menus/learn_gitlab_menu.rb')
-rw-r--r--lib/sidebars/projects/menus/learn_gitlab_menu.rb62
1 files changed, 62 insertions, 0 deletions
diff --git a/lib/sidebars/projects/menus/learn_gitlab_menu.rb b/lib/sidebars/projects/menus/learn_gitlab_menu.rb
new file mode 100644
index 00000000000..e3fcd8f25d5
--- /dev/null
+++ b/lib/sidebars/projects/menus/learn_gitlab_menu.rb
@@ -0,0 +1,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