Wednesday, May 21st, 2008
We all want to use
input[type=text] but browser support doesn’t seem to quite be there (IE 6?).
This lead James Coglan down the path of creating a teeny Rails plugin, classy_inputs:
Good lord do I ever hate input tags. (YUI hates them too, but Iâ€™ll leave that story for another time). All the different types should really have been different tag names, and they are a total pain to use with CSS. As such, I used to end up doing tedious stuff like adding a :class option to every form element when writing Rails templates. A while back, I tried to patch Rails to get it to do this automatically, but its test suite totally baffled me at the time by applying the classes in some places but not others.
So, a quick plugin to stave off RSI:
With that installed, any input tag created using a Rails view method will gain a class name matching its type attribute. Maybe Iâ€™ll have another stab at patching Rails, but Iâ€™m not promising anything.
Posted by Dion Almaer at 9:50 am