Created
January 4, 2009 16:07
-
-
Save mdarby/43084 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# application_helper.rb | |
# Generic form label styling | |
def box_label(text) | |
text = "#{text}:" unless text.end_with?(":") | |
"<span class=\"box_label\">#{text}</span>" | |
end | |
# A generic box to encapsulate some text | |
def box(title = nil, *args, &block) | |
options = args.extract_options! | |
style = options[:style] ? " style = '#{options[:style]}'" : '' | |
b = "<div class=\"box\"#{style}>#{box_label(title) if title}" | |
e = '</div>' | |
data = capture(&block) | |
res = b + data + e | |
concat(res, block.binding) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment