Skip to content

Commit

Permalink
fix flash_tag() with multiple attributes.
Browse files Browse the repository at this point in the history
  • Loading branch information
tmtm committed Apr 1, 2013
1 parent 3c4f995 commit 4878485
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb
Expand Up @@ -32,7 +32,7 @@ def flash_tag(*args)
bootstrap = options.delete(:bootstrap) if options[:bootstrap]
args.inject(''.html_safe) do |html,kind|
flash_text = flash[kind]
next if flash_text.blank?
next html if flash_text.blank?
flash_text << safe_content_tag(:button, "&times;", {:type => :button, :class => :close, :'data-dismiss' => :alert}) if bootstrap
html << safe_content_tag(:div, flash_text, options.reverse_merge(:class => kind))
end
Expand Down
2 changes: 1 addition & 1 deletion padrino-helpers/test/test_asset_tag_helpers.rb
Expand Up @@ -23,7 +23,7 @@ def flash
should "display multiple flash tags with given attributes" do
flash[:error] = 'wrong'
flash[:success] = 'okey'
actual_html = flash_tag(:success, :error, :id => 'area')
actual_html = flash_tag(:success, :warning, :error, :id => 'area')
assert_has_tag('div.success#area', :content => flash[:success]) { actual_html }
assert_has_tag('div.error#area', :content => flash[:error]) { actual_html }
assert_has_no_tag('div.notice') { actual_html }
Expand Down

0 comments on commit 4878485

Please sign in to comment.