Top Level Namespace

Defined Under Namespace

Modules: BootboxCrud

Instance Method Summary collapse

Instance Method Details

#form_input_error_hint(form) ⇒ Object



29
30
31
32
33
# File 'lib/generators/bootbox_crud/templates/config/initializers/simple_form_bootstrap.rb', line 29

def form_input_error_hint(form)
  form.use :input, class: 'form-control'
  form.use :error, wrap_with: { tag: 'span', class: 'help-block' }
  form.use :hint,  wrap_with: { tag: 'p', class: 'help-block' }
end

#form_optional(form) ⇒ Object



22
23
24
25
26
27
# File 'lib/generators/bootbox_crud/templates/config/initializers/simple_form_bootstrap.rb', line 22

def form_optional(form)
  form.optional :maxlength
  form.optional :pattern
  form.optional :min_max
  form.optional :readonly
end

#html5_placeholder(wrapper) ⇒ Object

Use this setup block to configure all options available in SimpleForm.



3
4
5
6
# File 'lib/generators/bootbox_crud/templates/config/initializers/simple_form_bootstrap.rb', line 3

def html5_placeholder(wrapper)
  wrapper.use :html5
  wrapper.use :placeholder
end

#html5_readonly_label(input) ⇒ Object



8
9
10
11
12
# File 'lib/generators/bootbox_crud/templates/config/initializers/simple_form_bootstrap.rb', line 8

def html5_readonly_label(input)
  input.use :html5
  input.optional :readonly
  input.use :label, class: 'col-sm-5 control-label'
end

#input(input) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/generators/bootbox_crud/templates/config/initializers/simple_form_bootstrap.rb', line 14

def input(input)
  input.wrapper tag: 'div', class: 'input-group col-sm-12' do |append|
    append.use :input, class: 'form-control'
  end
  input.use :error, wrap_with: { tag: 'span', class: 'help-block' }
  input.use :hint,  wrap_with: { tag: 'p', class: 'help-block' }
end