Overriding html generated for submit_tag and selected links

Hi,

Probably something simple, but I'm trying to change my submit_tag and other buttons to CSS based buttons based on the article at http://www.oscaralexander.com/tutorials/how-to-make-sexy-buttons-with-css.html

Basically this needs the following HTML markup:

<a class="button" href="#"><span>Button Text</span></a>

So, the question is how can I change the generated HTML (or better yet create a helper) to allow me to spit this out for form actions and some link_to's, specifically the inner <span> bit?

Any help would be appreciated as my google-fu has not been strong on this one. I'm on rails 2.3.2.

Cheers,

Steve

Hi Steve,

Acutally, there are no way to do it for submit_tag & button_to, those helpers should be totally rewritten to suport the markup you need. But if you are building a modern unobtrusive app, then you don't really need the functionality of those helpers, so you can just replace them with a custom helper that just generates the markup you need.

And cusomizing the link_to is quite easy:

def cool_link_to(title, url, options = {})   options[:class] ||= ''   options[:class] += ' button'   link_to(content_tag(:span, title), url, options) end

<%= cool_link_to "Edit", '/edit/123', :class => 'some-other-class' %> # => <a href="/edit/123" class="some-other-class button"><span>Edit</

</a>

Dmitry