summaryrefslogtreecommitdiff
path: root/app/components
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-05-19 07:33:21 +0000
commit36a59d088eca61b834191dacea009677a96c052f (patch)
treee4f33972dab5d8ef79e3944a9f403035fceea43f /app/components
parenta1761f15ec2cae7c7f7bbda39a75494add0dfd6f (diff)
downloadgitlab-ce-36a59d088eca61b834191dacea009677a96c052f.tar.gz
Add latest changes from gitlab-org/gitlab@15-0-stable-eev15.0.0-rc42
Diffstat (limited to 'app/components')
-rw-r--r--app/components/diffs/overflow_warning_component.html.haml6
-rw-r--r--app/components/pajamas/alert_component.html.haml12
-rw-r--r--app/components/pajamas/alert_component.rb15
3 files changed, 26 insertions, 7 deletions
diff --git a/app/components/diffs/overflow_warning_component.html.haml b/app/components/diffs/overflow_warning_component.html.haml
index 907d066e73d..b184fa1d527 100644
--- a/app/components/diffs/overflow_warning_component.html.haml
+++ b/app/components/diffs/overflow_warning_component.html.haml
@@ -1,9 +1,9 @@
= render Pajamas::AlertComponent.new(title: _('Too many changes to show.'),
variant: :warning,
- alert_class: 'gl-mb-5') do
- .gl-alert-body
+ alert_class: 'gl-mb-5') do |c|
+ = c.body do
= message
- .gl-alert-actions
+ = c.actions do
= diff_link
= patch_link
diff --git a/app/components/pajamas/alert_component.html.haml b/app/components/pajamas/alert_component.html.haml
index a1d3c700e57..782ac8b9ca2 100644
--- a/app/components/pajamas/alert_component.html.haml
+++ b/app/components/pajamas/alert_component.html.haml
@@ -1,5 +1,6 @@
-.gl-alert{ role: 'alert', class: ["gl-alert-#{@variant}", @alert_class], data: @alert_data }
- = sprite_icon(icon, css_class: icon_classes)
+.gl-alert{ role: 'alert', class: [base_class, @alert_class], data: @alert_data }
+ - if @show_icon
+ = sprite_icon(icon, css_class: icon_classes)
- if @dismissible
%button.btn.gl-dismiss-btn.btn-default.btn-sm.gl-button.btn-default-tertiary.btn-icon.js-close{ type: 'button',
aria: { label: _('Dismiss') },
@@ -10,4 +11,9 @@
- if @title
%h4.gl-alert-title
= @title
- = content
+ - if body?
+ .gl-alert-body
+ = body
+ - if actions?
+ .gl-alert-actions
+ = actions
diff --git a/app/components/pajamas/alert_component.rb b/app/components/pajamas/alert_component.rb
index 4bb6c41661b..c1b2132da29 100644
--- a/app/components/pajamas/alert_component.rb
+++ b/app/components/pajamas/alert_component.rb
@@ -6,26 +6,39 @@ module Pajamas
# @param [String] title
# @param [Symbol] variant
# @param [Boolean] dismissible
+ # @param [Boolean] show_icon
# @param [String] alert_class
# @param [Hash] alert_data
# @param [String] close_button_class
# @param [Hash] close_button_data
def initialize(
- title: nil, variant: :info, dismissible: true,
+ title: nil, variant: :info, dismissible: true, show_icon: true,
alert_class: nil, alert_data: {}, close_button_class: nil, close_button_data: {})
@title = title
@variant = variant
@dismissible = dismissible
+ @show_icon = show_icon
@alert_class = alert_class
@alert_data = alert_data
@close_button_class = close_button_class
@close_button_data = close_button_data
end
+ def base_class
+ classes = ["gl-alert-#{@variant}"]
+ classes.push('gl-alert-not-dismissible') unless @dismissible
+ classes.push('gl-alert-no-icon') unless @show_icon
+
+ classes.join(' ')
+ end
+
private
delegate :sprite_icon, to: :helpers
+ renders_one :body
+ renders_one :actions
+
ICONS = {
info: 'information-o',
warning: 'warning',