Method: Padrino::Helpers::AssetTagHelpers#flash_tag
- Defined in:
- padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb
#flash_tag(*args) ⇒ String
Creates a div to display the flash of given type if it exists.
32 33 34 35 36 37 38 39 40 41 |
# File 'padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb', line 32 def flash_tag(*args) = args.last.is_a?(Hash) ? args.pop : {} bootstrap = .delete(:bootstrap) if [:bootstrap] args.inject(SafeBuffer.new) do |html,kind| next html unless flash[kind] flash_text = SafeBuffer.new << flash[kind] flash_text << content_tag(:button, '×'.html_safe, {:type => :button, :class => :close, :'data-dismiss' => :alert}) if bootstrap html << content_tag(:div, flash_text, { :class => kind }.update()) end end |