Rails gem, polymer-rails-forms (doesn't need to be used with rails)

116 views
Skip to first unread message

Joel Weber

unread,
Dec 18, 2014, 9:50:21 PM12/18/14
to polym...@googlegroups.com
Hey everyone, just wanted to let you know about a gem I just put out called polymer-rails-forms https://github.com/gearcommons/polymer-rails-forms. It, as you might guess, is for creating rails compatible forms in polymer. The 'rails compatible part' just means the form spits out rails friendly names on the inputs; other than that it's a straight polymer element. It's still lacking some pretty basic features, but it's also surprisingly powerful. 

Anyway, I'd love some feedback on it. It's my first gem, and first big dig into polymer, so be gentle. We're using is for some simple forms over at http://gearcommons.com, and we'll be dropping in some more complex forms with it over the next couple weeks.  

Anyway, hope it helps some people out since Polymer form support is apparently non-existent (at least for non-ajax forms, this can do either) it seemed worthwhile to build. 

Cheers, 

Joel

ty...@tsnieman.net

unread,
Dec 22, 2014, 4:59:32 PM12/22/14
to polym...@googlegroups.com
Very cool. I've got a fairly sizeable Rails app I've been integrating with Polymer lately, was wondering about how I'd do forms. Thanks for sharing.

Joel Weber

unread,
Mar 18, 2015, 2:58:03 AM3/18/15
to polym...@googlegroups.com
Wow, I can't believe this has been downloaded over 1600 times. Awesome!

This is just a notice that I've updated this gem in some fairly significant ways. The biggest is using arrays instead of objects to define a form's structure since and object's order isn't guaranteed. This will break forms from previous versions, but it's a relatively simple fix. Just change

this.structure = {
   field: { type: "string" }


to 

this.structure = [
   { key: "field", type: "string" }
]

Also, I've taken the form building mostly out of template loops since larger forms were slowing firefox down to a crawl. This should also help make the transition to polymer 0.8 a lot easier when it finally happens. Additionally it makes the markup look much cleaner in the inspector. 

Of course there's also some nice functionality fixes and code cleanups. Selects (single and multi) work now, there's file inputs instead of just image inputs, and complex json fields are supported. 

The other big really helpful changes (for me at least) are 'groups' and 'steps'. Groups are like nests except the don't affect the naming of fields, they're just for styling groups of elements. Steps break a form into multiple steps which was a pretty huge pain before. You can read a more on github https://github.com/gearcommons/polymer-rails-forms

Anyway hope it helps out. Feel free to contact me with any feedback or questions. 
Reply all
Reply to author
Forward
0 new messages