Class: Spurs::Flash::Builder

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::AssetTagHelper, ActionView::Helpers::TagHelper, ActionView::Helpers::TextHelper
Defined in:
lib/spurs/flash/builder.rb

Instance Method Summary collapse

Instance Method Details

#build_alert(message, my_options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/spurs/flash/builder.rb', line 8

def build_alert(message,my_options)
  if message == nil
    raise "No message! #{my_options.to_json}"
  end
  my_content = String.new

  if my_options[:close_button]
    my_content.concat((:a, "×".html_safe, :class => :close, 'data-dismiss' => :alert))
  end

  header_content = my_options[:title]
  if my_options[:title_icon]
    header_content = (:img, nil, :src => "/assets/#{my_options[:title_icon]}", :style => "margin-bottom: 2px; margin-right: 5px; float: left").concat(header_content)
  end

  my_content.concat(alert_header_tag(header_content))

  my_content.concat((:p, message.to_s.html_safe))


  alert_tag(my_content.html_safe, my_options)
end