Question

I'm starting to use the jQuery UI CSS Framework for an app, which means I have to start adding classes to everything. So, for example, I want to make all buttons jQuery-themed, which means adding a class to all buttons.

I imagine there's some way in Rails to modify the helpers so I don't have to manually add a :class => 'blah' to every button, but I can't work it out. Is this possible, or does anybody have any better ideas?

Was it helpful?

Solution

You just need override the helper method with this class add. In your application_helper.rb

  def button_to(name, options = {}, html_options = {})
    super(name, options, html_options.merge(:class => 'blah'))
  end

OTHER TIPS

Why not use jquery, somthing like:

$('button').attr('class', 'blah');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top