summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-02-23 09:14:52 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-02-23 09:14:52 +0000
commit347bf09d6ecf4871da234c06ca8ee541e27b5105 (patch)
tree2ad6943e0c681c22acc8850d1debc6a983b0e006 /app/helpers
parent0a51be0866d33273070f535257626a9eb2e10700 (diff)
downloadgitlab-ce-13.10.0-rc20210223090520.tar.gz
Add latest changes from gitlab-org/gitlab@13-10-stable-eev13.10.0-rc20210223090520
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb2
-rw-r--r--app/helpers/auth_helper.rb19
-rw-r--r--app/helpers/commits_helper.rb4
-rw-r--r--app/helpers/invite_members_helper.rb8
-rw-r--r--app/helpers/issuables_description_templates_helper.rb17
-rw-r--r--app/helpers/projects_helper.rb15
-rw-r--r--app/helpers/services_helper.rb8
-rw-r--r--app/helpers/stat_anchors_helper.rb3
8 files changed, 60 insertions, 16 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8268ab1ad56..9af45daaca4 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -280,7 +280,7 @@ module ApplicationHelper
def page_class
class_names = []
- class_names << 'issue-boards-page gl-overflow-hidden' if current_controller?(:boards)
+ class_names << 'issue-boards-page gl-overflow-auto' if current_controller?(:boards)
class_names << 'environment-logs-page' if current_controller?(:logs)
class_names << 'with-performance-bar' if performance_bar_enabled?
class_names << system_message_class
diff --git a/app/helpers/auth_helper.rb b/app/helpers/auth_helper.rb
index 24c1d224c89..305b9a1faf3 100644
--- a/app/helpers/auth_helper.rb
+++ b/app/helpers/auth_helper.rb
@@ -1,7 +1,20 @@
# frozen_string_literal: true
module AuthHelper
- PROVIDERS_WITH_ICONS = %w(twitter github gitlab bitbucket google_oauth2 facebook azure_oauth2 authentiq salesforce atlassian_oauth2 openid_connect).freeze
+ PROVIDERS_WITH_ICONS = %w(
+ atlassian_oauth2
+ authentiq
+ azure_activedirectory_v2
+ azure_oauth2
+ bitbucket
+ facebook
+ github
+ gitlab
+ google_oauth2
+ openid_connect
+ salesforce
+ twitter
+ ).freeze
LDAP_PROVIDER = /\Aldap/.freeze
def ldap_enabled?
@@ -125,11 +138,11 @@ module AuthHelper
label = label_for_provider(provider)
if provider_has_custom_icon?(provider)
- image_tag(icon_for_provider(provider), alt: label, title: "Sign in with #{label}")
+ image_tag(icon_for_provider(provider), alt: label, title: "Sign in with #{label}", class: "gl-button-icon")
elsif provider_has_builtin_icon?(provider)
file_name = "#{provider.to_s.split('_').first}_#{size}.png"
- image_tag("auth_buttons/#{file_name}", alt: label, title: "Sign in with #{label}")
+ image_tag("auth_buttons/#{file_name}", alt: label, title: "Sign in with #{label}", class: "gl-button-icon")
else
label
end
diff --git a/app/helpers/commits_helper.rb b/app/helpers/commits_helper.rb
index f5c75d62097..2f5bfc181cb 100644
--- a/app/helpers/commits_helper.rb
+++ b/app/helpers/commits_helper.rb
@@ -105,7 +105,7 @@ module CommitsHelper
tooltip = _("Browse Directory")
end
- link_to url, class: "btn gl-button btn-default has-tooltip", title: tooltip, data: { container: "body" } do
+ link_to url, class: "btn gl-button btn-default btn-icon has-tooltip", title: tooltip, data: { container: "body" } do
sprite_icon('folder-open')
end
end
@@ -127,7 +127,7 @@ module CommitsHelper
end
def conditionally_paginate_diff_files(diffs, paginate:, per: Projects::CommitController::COMMIT_DIFFS_PER_PAGE)
- if paginate && Feature.enabled?(:paginate_commit_view, @project, type: :development)
+ if paginate
Kaminari.paginate_array(diffs.diff_files.to_a).page(params[:page]).per(per)
else
diffs.diff_files
diff --git a/app/helpers/invite_members_helper.rb b/app/helpers/invite_members_helper.rb
index 889365e39de..961ef613a06 100644
--- a/app/helpers/invite_members_helper.rb
+++ b/app/helpers/invite_members_helper.rb
@@ -23,6 +23,14 @@ module InviteMembersHelper
end
end
+ def show_invite_members_track_event
+ if directly_invite_members?
+ 'show_invite_members'
+ elsif indirectly_invite_members?
+ 'show_invite_members_version_b'
+ end
+ end
+
def invite_group_members?(group)
experiment_enabled?(:invite_members_empty_group_version_a) && Ability.allowed?(current_user, :admin_group_member, group)
end
diff --git a/app/helpers/issuables_description_templates_helper.rb b/app/helpers/issuables_description_templates_helper.rb
index 110b3954900..5f69098de56 100644
--- a/app/helpers/issuables_description_templates_helper.rb
+++ b/app/helpers/issuables_description_templates_helper.rb
@@ -5,7 +5,8 @@ module IssuablesDescriptionTemplatesHelper
include GitlabRoutingHelper
def template_dropdown_tag(issuable, &block)
- title = selected_template(issuable) || "Choose a template"
+ selected_template = selected_template(issuable)
+ title = selected_template || "Choose a template"
options = {
toggle_class: 'js-issuable-selector',
title: title,
@@ -15,7 +16,7 @@ module IssuablesDescriptionTemplatesHelper
data: {
data: issuable_templates(ref_project, issuable.to_ability_name),
field_name: 'issuable_template',
- selected: selected_template(issuable),
+ selected: selected_template,
project_id: ref_project.id
}
}
@@ -28,15 +29,21 @@ module IssuablesDescriptionTemplatesHelper
def issuable_templates(project, issuable_type)
@template_types ||= {}
@template_types[project.id] ||= {}
- @template_types[project.id][issuable_type] ||= TemplateFinder.all_template_names_array(project, issuable_type.pluralize)
+ @template_types[project.id][issuable_type] ||= TemplateFinder.all_template_names_hash_or_array(project, issuable_type)
end
def issuable_templates_names(issuable)
- issuable_templates(ref_project, issuable.to_ability_name).map { |template| template[:name] }
+ all_templates = issuable_templates(ref_project, issuable.to_ability_name)
+
+ if ref_project.inherited_issuable_templates_enabled?
+ all_templates.values.flatten.map { |tpl| tpl[:name] if tpl[:project_id] == ref_project.id }.compact.uniq
+ else
+ all_templates.map { |template| template[:name] }
+ end
end
def selected_template(issuable)
- params[:issuable_template] if issuable_templates(ref_project, issuable.to_ability_name).any? { |template| template[:name] == params[:issuable_template] }
+ params[:issuable_template] if issuable_templates_names(issuable).any? { |tmpl_name| tmpl_name == params[:issuable_template] }
end
def template_names_path(parent, issuable)
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index f5cd89d96b4..b5c4e0b5550 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -379,10 +379,15 @@ module ProjectsHelper
private
def can_read_security_configuration?(project, current_user)
- ::Feature.enabled?(:secure_security_and_compliance_configuration_page_on_ce, @subject, default_enabled: :yaml) &&
+ show_security_and_compliance_config? &&
+ can?(current_user, :access_security_and_compliance, project) &&
can?(current_user, :read_security_configuration, project)
end
+ def show_security_and_compliance_config?
+ ::Feature.enabled?(:secure_security_and_compliance_configuration_page_on_ce, @subject, default_enabled: :yaml)
+ end
+
def get_project_security_nav_tabs(project, current_user)
if can_read_security_configuration?(project, current_user)
[:security_and_compliance, :security_configuration]
@@ -646,7 +651,8 @@ module ProjectsHelper
metricsDashboardAccessLevel: feature.metrics_dashboard_access_level,
operationsAccessLevel: feature.operations_access_level,
showDefaultAwardEmojis: project.show_default_award_emojis?,
- allowEditingCommitMessages: project.allow_editing_commit_messages?
+ allowEditingCommitMessages: project.allow_editing_commit_messages?,
+ securityAndComplianceAccessLevel: project.security_and_compliance_access_level
}
end
@@ -668,10 +674,13 @@ module ProjectsHelper
pagesAvailable: Gitlab.config.pages.enabled,
pagesAccessControlEnabled: Gitlab.config.pages.access_control,
pagesAccessControlForced: ::Gitlab::Pages.access_control_is_forced?,
- pagesHelpPath: help_page_path('user/project/pages/introduction', anchor: 'gitlab-pages-access-control')
+ pagesHelpPath: help_page_path('user/project/pages/introduction', anchor: 'gitlab-pages-access-control'),
+ securityAndComplianceAvailable: show_security_and_compliance_toggle?
}
end
+ alias_method :show_security_and_compliance_toggle?, :show_security_and_compliance_config?
+
def project_permissions_panel_data_json(project)
project_permissions_panel_data(project).to_json.html_safe
end
diff --git a/app/helpers/services_helper.rb b/app/helpers/services_helper.rb
index 14d20e7c622..8fc63dcdb3a 100644
--- a/app/helpers/services_helper.rb
+++ b/app/helpers/services_helper.rb
@@ -86,7 +86,7 @@ module ServicesHelper
end
def integration_form_data(integration, group: nil)
- {
+ form_data = {
id: integration.id,
show_active: integration.show_active_box?.to_s,
activated: (integration.active || integration.new_record?).to_s,
@@ -106,6 +106,12 @@ module ServicesHelper
test_path: scoped_test_integration_path(integration),
reset_path: scoped_reset_integration_path(integration, group: group)
}
+
+ if integration.is_a?(JiraService)
+ form_data[:jira_issue_transition_id] = integration.jira_issue_transition_id
+ end
+
+ form_data
end
def trigger_events_for_service(integration)
diff --git a/app/helpers/stat_anchors_helper.rb b/app/helpers/stat_anchors_helper.rb
index 1e8e6371284..d9429f28be7 100644
--- a/app/helpers/stat_anchors_helper.rb
+++ b/app/helpers/stat_anchors_helper.rb
@@ -5,13 +5,14 @@ module StatAnchorsHelper
{}.tap do |attrs|
attrs[:class] = %w(nav-link gl-display-flex gl-align-items-center) << extra_classes(anchor)
attrs[:itemprop] = anchor.itemprop if anchor.itemprop
+ attrs[:data] = anchor.data if anchor.data
end
end
private
def button_attribute(anchor)
- "btn-#{anchor.class_modifier || 'dashed'}"
+ anchor.class_modifier || 'btn-dashed'
end
def extra_classes(anchor)