2021-12-17 01:15:21 -05:00
|
|
|
-# We currently only support `alert`, `notice`, `success`, 'toast', and 'raw'
|
2021-04-14 08:09:25 -04:00
|
|
|
- icons = {'alert' => 'error', 'notice' => 'information-o', 'success' => 'check-circle'}
|
2022-02-10 07:18:48 -05:00
|
|
|
- type_to_variant = {'alert' => 'danger', 'notice' => 'info', 'success' => 'success'}
|
2020-11-05 19:09:14 -05:00
|
|
|
.flash-container.flash-container-page.sticky{ data: { qa_selector: 'flash_container' } }
|
2017-11-20 11:40:01 -05:00
|
|
|
- flash.each do |key, value|
|
2019-12-10 02:53:40 -05:00
|
|
|
- if key == 'toast' && value
|
|
|
|
.js-toast-message{ data: { message: value } }
|
2021-12-17 01:15:21 -05:00
|
|
|
- elsif key == 'raw' && value
|
|
|
|
= value
|
2021-06-24 14:07:15 -04:00
|
|
|
- elsif value == I18n.t('devise.failure.unconfirmed')
|
|
|
|
= render 'shared/confirm_your_email_alert'
|
2019-12-10 02:53:40 -05:00
|
|
|
- elsif value
|
2022-02-10 07:18:48 -05:00
|
|
|
%div{ class: "flash-#{key} mb-2", data: { testid: "alert-#{type_to_variant[key]}" } }
|
2020-08-10 14:09:54 -04:00
|
|
|
= sprite_icon(icons[key], css_class: 'align-middle mr-1') unless icons[key].nil?
|
2019-09-03 05:03:35 -04:00
|
|
|
%span= value
|
2020-07-17 17:09:23 -04:00
|
|
|
- if %w(alert notice success).include?(key)
|
|
|
|
%div{ class: "close-icon-wrapper js-close-icon" }
|
2020-09-15 14:09:43 -04:00
|
|
|
= sprite_icon('close', css_class: 'close-icon gl-vertical-align-baseline!')
|