Module: Para::FlashHelper

Defined in:
app/helpers/para/flash_helper.rb

Instance Method Summary collapse

Instance Method Details

#display_admin_flashObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'app/helpers/para/flash_helper.rb', line 3

def display_admin_flash
  # Render empty string if no flash
  return "" if flash.empty?

  # Make a div.alert for each message and join the whole
  messages = flash.map do |type, message|
    flash.delete(type)
    type = homogenize_flash_type(type)

    icon = (:div, class: "alert-icon-container pull-left") do
      (:i, "", class: "fa #{ icon_class_for(type) }") +
      ' '.html_safe
    end

    alert(type: type) do
      icon + (:p, message.html_safe)
    end
  end

  # Join the messages and make sure markup is correctly displayed
  messages.join.html_safe
end