Class: BootstrapFormBuilder
- Inherits:
-
ActionView::Helpers::FormBuilder
- Object
- ActionView::Helpers::FormBuilder
- BootstrapFormBuilder
- Defined in:
- app/form_builders/bootstrap_form_builder.rb
Instance Method Summary collapse
Instance Method Details
#check_box(name) ⇒ Object
38 39 40 41 42 43 44 |
# File 'app/form_builders/bootstrap_form_builder.rb', line 38 def check_box(name) wrapper name do content_tag :label, class: 'checkbox' do super(name) end end end |
#errors_for ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/form_builders/bootstrap_form_builder.rb', line 4 def errors_for return "" if @object.errors.empty? = @object.errors..map { |msg| content_tag(:li, msg) }.join sentence = I18n.t( "errors.messages.not_saved", :count => @object.errors.count, :resource => @object.class.model_name.human.downcase ) html = <<-HTML <div class="alert alert-error"> <p><b>#{sentence}</b></p> <ul>#{}</ul> </div> HTML html.html_safe end |
#submit(value = nil) ⇒ Object
46 47 48 49 50 |
# File 'app/form_builders/bootstrap_form_builder.rb', line 46 def submit(value=nil) content_tag :div, class: 'form-actions' do super value, class: 'btn btn-primary' end end |