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:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 04:43:31 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-24 04:43:31 +0300
commite20a1cde5d740fbc9f4d033786a8cd5ad7eb8b4d (patch)
treecf76b0527f1909eaf1ecac057a4ccc7591cce4f6 /app/helpers
parent5fc725def41e6973e92bc32095774edd60fd154f (diff)
Add latest changes from gitlab-org/gitlab@12-10-stable-ee
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/analytics/navbar_helper.rb69
-rw-r--r--app/helpers/analytics_navbar_helper.rb67
-rw-r--r--app/helpers/ci_variables_helper.rb2
-rw-r--r--app/helpers/explore_helper.rb2
-rw-r--r--app/helpers/groups_helper.rb1
5 files changed, 72 insertions, 69 deletions
diff --git a/app/helpers/analytics/navbar_helper.rb b/app/helpers/analytics/navbar_helper.rb
new file mode 100644
index 00000000000..ddf2655c887
--- /dev/null
+++ b/app/helpers/analytics/navbar_helper.rb
@@ -0,0 +1,69 @@
+# frozen_string_literal: true
+
+module Analytics
+ module NavbarHelper
+ class NavbarSubItem
+ attr_reader :title, :path, :link, :link_to_options
+
+ def initialize(title:, path:, link:, link_to_options: {})
+ @title = title
+ @path = path
+ @link = link
+ @link_to_options = link_to_options.merge(title: title)
+ end
+ end
+
+ def project_analytics_navbar_links(project, current_user)
+ [
+ cycle_analytics_navbar_link(project, current_user),
+ repository_analytics_navbar_link(project, current_user),
+ ci_cd_analytics_navbar_link(project, current_user)
+ ].compact
+ end
+
+ def group_analytics_navbar_links(group, current_user)
+ []
+ end
+
+ private
+
+ def navbar_sub_item(args)
+ NavbarSubItem.new(args)
+ end
+
+ def cycle_analytics_navbar_link(project, current_user)
+ return unless project_nav_tab?(:cycle_analytics)
+
+ navbar_sub_item(
+ title: _('Value Stream'),
+ path: 'cycle_analytics#show',
+ link: project_cycle_analytics_path(project),
+ link_to_options: { class: 'shortcuts-project-cycle-analytics' }
+ )
+ end
+
+ def repository_analytics_navbar_link(project, current_user)
+ return if project.empty_repo?
+
+ navbar_sub_item(
+ title: _('Repository'),
+ path: 'graphs#charts',
+ link: charts_project_graph_path(project, current_ref),
+ link_to_options: { class: 'shortcuts-repository-charts' }
+ )
+ end
+
+ def ci_cd_analytics_navbar_link(project, current_user)
+ return unless project_nav_tab?(:pipelines)
+ return unless project.feature_available?(:builds, current_user) || !project.empty_repo?
+
+ navbar_sub_item(
+ title: _('CI / CD'),
+ path: 'pipelines#charts',
+ link: charts_project_pipelines_path(project)
+ )
+ end
+ end
+end
+
+Analytics::NavbarHelper.prepend_if_ee('EE::Analytics::NavbarHelper')
diff --git a/app/helpers/analytics_navbar_helper.rb b/app/helpers/analytics_navbar_helper.rb
deleted file mode 100644
index f94119c4eef..00000000000
--- a/app/helpers/analytics_navbar_helper.rb
+++ /dev/null
@@ -1,67 +0,0 @@
-# frozen_string_literal: true
-
-module AnalyticsNavbarHelper
- class NavbarSubItem
- attr_reader :title, :path, :link, :link_to_options
-
- def initialize(title:, path:, link:, link_to_options: {})
- @title = title
- @path = path
- @link = link
- @link_to_options = link_to_options.merge(title: title)
- end
- end
-
- def project_analytics_navbar_links(project, current_user)
- [
- cycle_analytics_navbar_link(project, current_user),
- repository_analytics_navbar_link(project, current_user),
- ci_cd_analytics_navbar_link(project, current_user)
- ].compact
- end
-
- def group_analytics_navbar_links(group, current_user)
- []
- end
-
- private
-
- def navbar_sub_item(args)
- NavbarSubItem.new(args)
- end
-
- def cycle_analytics_navbar_link(project, current_user)
- return unless project_nav_tab?(:cycle_analytics)
-
- navbar_sub_item(
- title: _('Value Stream'),
- path: 'cycle_analytics#show',
- link: project_cycle_analytics_path(project),
- link_to_options: { class: 'shortcuts-project-cycle-analytics' }
- )
- end
-
- def repository_analytics_navbar_link(project, current_user)
- return if project.empty_repo?
-
- navbar_sub_item(
- title: _('Repository'),
- path: 'graphs#charts',
- link: charts_project_graph_path(project, current_ref),
- link_to_options: { class: 'shortcuts-repository-charts' }
- )
- end
-
- def ci_cd_analytics_navbar_link(project, current_user)
- return unless project_nav_tab?(:pipelines)
- return unless project.feature_available?(:builds, current_user) || !project.empty_repo?
-
- navbar_sub_item(
- title: _('CI / CD'),
- path: 'pipelines#charts',
- link: charts_project_pipelines_path(project)
- )
- end
-end
-
-AnalyticsNavbarHelper.prepend_if_ee('EE::AnalyticsNavbarHelper')
diff --git a/app/helpers/ci_variables_helper.rb b/app/helpers/ci_variables_helper.rb
index df220effd5d..cd0718c1b82 100644
--- a/app/helpers/ci_variables_helper.rb
+++ b/app/helpers/ci_variables_helper.rb
@@ -7,7 +7,7 @@ module CiVariablesHelper
def create_deploy_token_path(entity, opts = {})
if entity.is_a?(Group)
- create_deploy_token_group_settings_ci_cd_path(entity, opts)
+ create_deploy_token_group_settings_repository_path(entity, opts)
else
# TODO: change this path to 'create_deploy_token_project_settings_ci_cd_path'
# See MR comment for more detail: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27059#note_311585356
diff --git a/app/helpers/explore_helper.rb b/app/helpers/explore_helper.rb
index b341cc795a0..b66c7a69b71 100644
--- a/app/helpers/explore_helper.rb
+++ b/app/helpers/explore_helper.rb
@@ -52,7 +52,7 @@ module ExploreHelper
end
def public_visibility_restricted?
- Gitlab::CurrentSettings.restricted_visibility_levels.include? Gitlab::VisibilityLevel::PUBLIC
+ Gitlab::CurrentSettings.restricted_visibility_levels&.include? Gitlab::VisibilityLevel::PUBLIC
end
private
diff --git a/app/helpers/groups_helper.rb b/app/helpers/groups_helper.rb
index 2cd685ddcd4..91f8bc33e3e 100644
--- a/app/helpers/groups_helper.rb
+++ b/app/helpers/groups_helper.rb
@@ -15,6 +15,7 @@ module GroupsHelper
groups#projects
groups#edit
badges#index
+ repository#show
ci_cd#show
integrations#index
integrations#edit