Skip to content

Instantly share code, notes, and snippets.

@markevans
Created April 6, 2010 22:25
Show Gist options
  • Save markevans/358202 to your computer and use it in GitHub Desktop.
Save markevans/358202 to your computer and use it in GitHub Desktop.
# In helper file:
class ContentBox < BlockHelpers::Base
def initialize(title)
@title = title
end
def display(body)
%(
<div class="content_box">
#{content_tag(:h3, @title) if @title}
<div class="inner">
#{body}
</div>
</div>
)
end
end
# In view:
<% content_box 'Thingy' do %>
Some content here
<% end %>
# Then style '.content_box h3' and '.content_box .inner' as you wish in CSS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment