Skip to content

Commit

Permalink
better default html for form messages
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoward committed Sep 9, 2013
1 parent 6fbb6a8 commit 2e8d908
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions lib/dao/messages.rb
Expand Up @@ -27,19 +27,25 @@ def Messages.to_html(*args, &block)
if block
define_method(:to_html, &block)
else
div_(:class => "dao dao-messages"){
Messages.each(*args) do |message|
slug = Slug.for(message.type)
at_least_one = false

div_(:class => "dao dao-message alert alert-block alert-#{ slug }"){
tagz << message << ' '
html =
div_(:class => "dao dao-messages"){
Messages.each(*args) do |message|
at_least_one = true
slug = Slug.for(message.type)

a_(:href => "#", :class => "close", :data_dismiss => "alert", :onClick => "javascript:$(this).closest('div').remove();false;"){
Tagz.html_safe('&times;')
div_(:class => "dao dao-message alert alert-block alert-#{ slug }"){
tagz << message << ' '

a_(:href => "#", :class => "close", :data_dismiss => "alert", :onClick => "javascript:$(this).closest('div').remove();false;"){
Tagz.html_safe('&times;')
}
}
}
end
}
end
}

at_least_one ? html : ''
end
end

Expand Down

0 comments on commit 2e8d908

Please sign in to comment.