I'm looking for a general way to apply some external CSS frameworks in a Rails application. These structures typically define the set of class names that should be used for certain HTML elements.
Consider the jQuery UI. To achieve a consistent form style, you would want something like this:
Doing this for each input field is not DRY at all.
Even a helper method, for example
or
doesn't look right (or more DRY) since you still have to touch the generated form view ...
Alternative methods can now be the beheading of the InstanceTag class or hack the form_for .
Has anyone done this before?
By the way, I would not use jQuery (or Javascript at all) to apply class attributes, since JS can be disabled or blocked or even delivered with a delay and cause flickering ...
Cheers
Dominik
source share