stouset / twitter_bootstrap_form_for

A Rails FormBuilder DSL for generating Twitter Bootstrap forms
https://github.com/stouset/twitter_bootstrap_form_for
MIT License
409 stars 110 forks source link

ability to work with simple_form #6

Closed wiktorschmidt closed 12 years ago

wiktorschmidt commented 12 years ago

I'd love to use this along with simple_form f.input. I don't think it's possible at the moment? Is it?

stouset commented 12 years ago

Can you provide an example?

wiktorschmidt commented 12 years ago

Simpleform example:

<%= simple_form_for @user do |f| %>
  <%= f.input :username, :label => 'Your username please' %>

It would be nice to be able to do:

<%= twitter_bootstrap_form_for @user do |f| %>
  <%= f.input :username, :label => 'Your username please' %>
stouset commented 12 years ago

Is it really that much effort to specify what kind of field you want? The syntax I provide even ends up being shorter in most cases, I think you'll find.

<%= f.email_field :email, 'Your email address', :placeholder => 'me@example.com' %>
<%= f.input :email, :label => 'Your email address', :input_html => { :placeholder => 'me@example.com' } %>

I don't really see the benefit.

Although it is nice for users to be able to override options on the other elements. I might consider adding hash options for :label_html, :wrapper_html, etc.

wiktorschmidt commented 12 years ago

Well - that's what simple_form is providing - just a convention :) https://github.com/plataformatec/simple_form and the syntax is consistent with formtastic. I know a lot of people are familiar with that. Also there are projects that can be very easily migrated if the syntax was the same.

stouset commented 12 years ago

I appreciate that, but I think more people likely use the existing Rails helpers. That, and this project is a simple wrapper on top of those helpers. Maintaining a completely parallel FormBuilder with its own syntax (which I personally find to be less flexible, useful, and readable than the current out-of-box experience) adds another level of complexity I'm just not eager to write and maintain.

This project is actually a spin-off of another project I started, semantic_form_for, which was a direct result of aggravation at the inflexibility and verbosity of Formtastic and SimpleForm. They're way more complicated than they need to be, as I think the syntax I provide here demonstrates.

With apologies, I just don't think I can justify the level of effort and complexity in writing and maintaining a second FormBuilder. Doubly so for one that I think has few benefits to offer. I'd be glad to add the :label_html and :wrapper_html options if you need them, however.