diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-19 08:27:35 +0000 |
commit | 7e9c479f7de77702622631cff2628a9c8dcbc627 (patch) | |
tree | c8f718a08e110ad7e1894510980d2155a6549197 /app/helpers/projects_helper.rb | |
parent | e852b0ae16db4052c1c567d9efa4facc81146e88 (diff) | |
download | gitlab-ce-13.6.0-rc42.tar.gz |
Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42
Diffstat (limited to 'app/helpers/projects_helper.rb')
-rw-r--r-- | app/helpers/projects_helper.rb | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index ae46135e890..f25b229d198 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -84,18 +84,8 @@ module ProjectsHelper end def project_title(project) - namespace_link = - if project.group - group_title(project.group, nil, nil) - else - owner = project.namespace.owner - link_to(simple_sanitize(owner.name), user_path(owner)) - end - - project_link = link_to project_path(project) do - icon = project_icon(project, alt: project.name, class: 'avatar-tile', width: 15, height: 15) if project.avatar_url && !Rails.env.test? - [icon, content_tag("span", simple_sanitize(project.name), class: "breadcrumb-item-text js-breadcrumb-item-text")].join.html_safe - end + namespace_link = build_namespace_breadcrumb_link(project) + project_link = build_project_breadcrumb_link(project) namespace_link = breadcrumb_list_item(namespace_link) unless project.group project_link = breadcrumb_list_item project_link @@ -302,7 +292,7 @@ module ProjectsHelper end def settings_operations_available? - can?(current_user, :read_environment, @project) + !@project.archived? && can?(current_user, :admin_operations, @project) end def error_tracking_setting_project_json @@ -465,6 +455,7 @@ module ProjectsHelper builds: :read_build, clusters: :read_cluster, serverless: :read_cluster, + terraform: :read_terraform_state, error_tracking: :read_sentry_issue, alert_management: :read_alert_management_alert, incidents: :read_issue, @@ -484,7 +475,8 @@ module ProjectsHelper :read_issue, :read_sentry_issue, :read_cluster, - :read_feature_flag + :read_feature_flag, + :read_terraform_state ].any? do |ability| can?(current_user, ability, project) end @@ -762,6 +754,7 @@ module ProjectsHelper metrics_dashboard feature_flags tracings + terraform ] end @@ -784,6 +777,30 @@ module ProjectsHelper def project_access_token_available?(project) can?(current_user, :admin_resource_access_tokens, project) end + + def build_project_breadcrumb_link(project) + project_name = simple_sanitize(project.name) + + push_to_schema_breadcrumb(project_name, project_path(project)) + + link_to project_path(project) do + icon = project_icon(project, alt: project_name, class: 'avatar-tile', width: 15, height: 15) if project.avatar_url && !Rails.env.test? + [icon, content_tag("span", project_name, class: "breadcrumb-item-text js-breadcrumb-item-text")].join.html_safe + end + end + + def build_namespace_breadcrumb_link(project) + if project.group + group_title(project.group, nil, nil) + else + owner = project.namespace.owner + name = simple_sanitize(owner.name) + url = user_path(owner) + + push_to_schema_breadcrumb(name, url) + link_to(name, url) + end + end end ProjectsHelper.prepend_if_ee('EE::ProjectsHelper') |