Module: AlertifyHelper
- Defined in:
- app/helpers/alertify_helper.rb
Constant Summary collapse
- ALERT_TYPES =
[:error, :info, :success, :warning]
Instance Method Summary collapse
Instance Method Details
#alertify_flash ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/helpers/alertify_helper.rb', line 4 def alertify_flash jsReturn = javascript_tag() flash.each do |type, | # Skip empty messages, e.g. for devise messages set to nothing in a locale file. next if .blank? type = :success if type == :notice type = :error if type == :alert next unless ALERT_TYPES.include?(type) js_alertify = "" Array().each do |msg| js_alertify << "alertify.#{type}('#{msg}');\n" if msg; end jsReturn = javascript_tag(js_alertify) end jsReturn.html_safe() end |