Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Revert "Use PrimerViewComponent Flash for the rails rendered flash messages"

Henriette Darge04aee5250b7c
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f7c7a42ceef..11c60ad5498 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -130,42 +130,22 @@ module ApplicationHelper
end
def render_flash_message(type, message, html_options = {})
- # Add autohide class to notice flashes if configured
- css_classes = User.current.pref.auto_hide_popups? ? 'autohide-toaster' : ''
-
- render(Primer::Beta::Flash.new(
- scheme: primer_flash_type(type),
- classes: css_classes,
- icon: primer_flash_icon_type(type)
- )) { join_flash_messages(message) }
- end
+ css_classes = ["flash #{type} icon icon-#{type}", html_options.delete(:class)]
- ##
- # Map our flash types to the ones used by Primer ViewComponent
- #
- def primer_flash_type(type)
- primer_types = {
- :"error" => :danger,
- :"notice" => :success,
- :"warning" => :warning,
- :"info" => :default,
- }
+ # Add autohide class to notice flashes if configured
+ if type.to_s == 'notice' && User.current.pref.auto_hide_popups?
+ css_classes << 'autohide-toaster'
+ end
- primer_types[type.to_sym]
- end
+ html_options = { class: css_classes.join(' '), role: 'alert' }.merge(html_options)
- ##
- # Map our icons used in flash to the octicons of Primer
- #
- def primer_flash_icon_type(type)
- primer_flash_icons = {
- :"error" => :'alert-fill',
- :"notice" => :check,
- :"warning" => :alert,
- :"info" => :info,
- }
-
- primer_flash_icons[type.to_sym]
+ content_tag :div, html_options do
+ concat(join_flash_messages(message))
+ concat(content_tag(:i, '', class: 'icon-close close-handler',
+ tabindex: '0',
+ role: 'button',
+ aria: { label: ::I18n.t('js.close_popup_title') }))
+ end
end
# Yields the given block for each project with its level in the tree