Skip to content

Instantly share code, notes, and snippets.

@atnan
Created November 24, 2008 03:00
Show Gist options
  • Save atnan/28361 to your computer and use it in GitHub Desktop.
Save atnan/28361 to your computer and use it in GitHub Desktop.
def rounded_block(options={}, &block)
raise ArgumentError, 'Missing block' unless block_given?
options.symbolize_keys!
concat(content_tag(:div, :id => options[:id], :class => ["rounded", options[:class]].compact.join(" ")) do
content_tag(:div, :class => "rounded-top") do
content_tag(:div, '', :class => "rounded-top-left") +
content_tag(:div, '', :class => "rounded-top-right") +
content_tag(:div, '', :class => "rounded-top-center")
end +
content_tag(:div, :class => 'rounded-content') do
capture(&block)
end +
content_tag(:div, :class => "rounded-bottom") do
content_tag(:div, '', :class => "rounded-bottom-left") +
content_tag(:div, '', :class => "rounded-bottom-right") +
content_tag(:div, '', :class => "rounded-bottom-center")
end
end, block.binding)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment