debian-mirror-gitlab/app/views/shared/_global_alert.html.haml

25 lines
1.4 KiB
Text
Raw Normal View History

2021-09-04 01:27:46 +05:30
- icons = { info: 'information-o', warning: 'warning', success: 'check-circle', danger: 'error', tip: 'bulb' }
- title = local_assigns.fetch(:title, nil)
- variant = local_assigns.fetch(:variant, :info)
2021-09-30 23:02:18 +05:30
- dismissible = local_assigns.fetch(:dismissible, true)
2021-09-04 01:27:46 +05:30
- alert_class = local_assigns.fetch(:alert_class, nil)
- alert_data = local_assigns.fetch(:alert_data, nil)
- close_button_class = local_assigns.fetch(:close_button_class, nil)
- close_button_data = local_assigns.fetch(:close_button_data, nil)
- icon = icons[variant]
2021-09-30 23:02:18 +05:30
- alert_root_class = 'gl-alert-layout-limited' if fluid_layout
- alert_container_class = [container_class, @content_class] unless fluid_layout || local_assigns.fetch(:is_contained, false)
2021-09-04 01:27:46 +05:30
2021-09-30 23:02:18 +05:30
%div{ role: 'alert', class: [alert_root_class, 'gl-alert-max-content', 'gl-alert', "gl-alert-#{variant}", alert_class], data: alert_data }
.gl-alert-container{ class: alert_container_class }
= sprite_icon(icon, size: 16, css_class: "gl-alert-icon#{' gl-alert-icon-no-title' if title.nil?}")
- 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') }, class: close_button_class, data: close_button_data }
2021-09-04 01:27:46 +05:30
= sprite_icon('close', size: 16)
2021-09-30 23:02:18 +05:30
.gl-alert-content{ role: 'alert' }
2021-09-04 01:27:46 +05:30
- if title
2021-09-30 23:02:18 +05:30
%h4.gl-alert-title
2021-09-04 01:27:46 +05:30
= title
= yield