mjbellantoni / formtastic-bootstrap

Formtastic form builder to generate Twitter Bootstrap-friendly markup.
MIT License
443 stars 218 forks source link

Support for non standard input classes #112

Closed gbisheimer closed 10 years ago

gbisheimer commented 10 years ago

Avoids the exception when using an input class not defined in FormtasticBootstrap namespace. For example, I'm using activeadmin-select2 GEM and this error raises when using FormtasticBootstrap as form builder like this:

<%= semantic_form_for [:admin, @invoice], builder: FormtasticBootstrap::FormBuilder do |f| %>
    <%= f.semantic_errors *f.object.errors.keys %>
    <%= f.inputs "Invoice" do %>
        <div class="row">
          <%= f.input :is_proforma, :wrapper_html => {:class => "col-md-1"} %>
          <%= f.input :partner, :as => :select2, :wrapper_html => {:class => "col-md-5"} %>
          <%= f.input :currency, :as => :select2, :wrapper_html => {:class => "col-md-2"} %>
          <%= f.input :currency_rate, :wrapper_html => {:class => "col-md-2"} %>
          <%= f.input :date_invoice, :as => :date_picker, :wrapper_html => {:class => "col-md-2"} %>
        </div>
    <% end %>
    <%= f.actions do %>
        <%= f.action :submit, :button_html => {:class => "btn btn-success pull-right"} %>
        <%= link_to "Cancel", [:admin, @invoice], {:class => "btn btn-default pull-right"} %>
    <% end %>
<% end %>