Absence
August 14th, 2007
I’ve been pretty busy lately with working several projects (4 at work and 1 at home) and haven’t had the time to put into this site as much as I would have liked. I do have some plans, in the future, of moving things around and bringing in a buddy of mine to help out with some cool snips on JavaScript. That means this site will be doing some changing – for a future post on my own blog.
Well, I didn’t start this post to just tell you that, I’ve got a few snips here for you to chew on. I’ll break them up in a few separate posts. Here is the first:
1 2 3 4 5 |
def button_for(name, options={}) return content_tag(:button, content_tag(:span, content_tag(:span, name)), :class => options[:class], :type => options[:button_type]) end |
The above creates a button element with a couple of span’s within it – not the most semantic, but it does provide a lot of flexibility when styling the button out. You pass the method a name for the inner-inner span element and then a class for the button element with a type (e.g. submit).
This method was originally from my buddy Kevin for one of our projects and I went in a just did a little polishing of the method.


Sorry, comments are closed for this article.