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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
dmitry.sokurenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2009-Apr-21 13:06 UTC
Re: Overriding html generated for submit_tag and selected links
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</ span></a> Dmitry