Module: Olelo::FlashHelper

Includes:
Util
Included in:
ApplicationHelper
Defined in:
lib/olelo/helper.rb

Defined Under Namespace

Classes: FlashHash

Instance Method Summary collapse

Methods included from Util

#check, #decode64, #deep_copy, #encode64, #escape, #escape_html, #escape_javascript, included, #md5, #no_cache?, #sha256, #titlecase, #truncate, #unescape, #unescape_backslash, #unescape_html, #valid_xml_chars?

Instance Method Details

#flashObject



110
111
112
# File 'lib/olelo/helper.rb', line 110

def flash
  @flash ||= FlashHash.new(env['rack.session'])
end

#flash_messagesObject



114
115
116
117
# File 'lib/olelo/helper.rb', line 114

def flash_messages
  li = [:error, :warn, :info].map {|level| flash[level].to_a.map {|msg| %{<li class="#{level}">#{escape_html msg}</li>} } }.flatten
  %{<ul class="flash">#{li.join}</ul>}.html_safe if !li.empty?
end