debian-mirror-gitlab/app/views/layouts/_flash.html.haml

18 lines
1 KiB
Text
Raw Normal View History

2022-11-25 23:54:43 +05:30
- flash_container_no_margin = local_assigns.fetch(:flash_container_no_margin, false)
- flash_container_class = ('flash-container-no-margin' if flash_container_no_margin)
-# We currently only support `alert`, `notice`, `success`, `warning`, 'toast', and 'raw'
- type_to_variant = {'alert' => 'danger', 'notice' => 'info', 'success' => 'success', 'warning' => 'warning'}
2022-08-13 15:12:31 +05:30
- closable = %w[alert notice success]
2022-11-25 23:54:43 +05:30
.flash-container.flash-container-page.sticky{ data: { qa_selector: 'flash_container' }, class: flash_container_class }
2018-03-17 18:26:18 +05:30
- flash.each do |key, value|
2020-01-01 13:55:28 +05:30
- if key == 'toast' && value
.js-toast-message{ data: { message: value } }
2022-01-26 12:08:38 +05:30
- elsif key == 'raw' && value
= value
2021-09-30 23:02:18 +05:30
- elsif value == I18n.t('devise.failure.unconfirmed')
= render 'shared/confirm_your_email_alert'
2020-01-01 13:55:28 +05:30
- elsif value
2022-11-25 23:54:43 +05:30
= render Pajamas::AlertComponent.new(variant: type_to_variant[key], dismissible: closable.include?(key), alert_options: {class: "flash-#{key}", data: { testid: "alert-#{type_to_variant[key]}" }}) do |c|
= c.with_body { value }