Module: SimpleForm::Bootstrap::FormBuilders::Button
- Defined in:
- lib/simple_form/bootstrap/form_builders/button.rb
Instance Method Summary collapse
-
#button(type, *args, &proc) ⇒ Object
Adds the btn-default class selectively to buttons which do not have an explicit button type.
Instance Method Details
#button(type, *args, &proc) ⇒ Object
Adds the btn-default class selectively to buttons which do not have an explicit button type.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/simple_form/bootstrap/form_builders/button.rb', line 3 def (type, *args, &proc) = args..dup [:class] = [*[:class]] # Add the specified class type. if [:class].select { |cls| cls.length < 4 || cls[0, 4] == 'btn-' }.empty? if type.to_s == :submit.to_s.freeze [:class] << 'btn-primary' else [:class] << 'btn-default' end end args << super(type, *args, &proc) end |