Class: ExtForm::Layouts::BootstrapLayout

Inherits:
Object
  • Object
show all
Includes:
BaseLayout
Defined in:
lib/ext_form/layouts/bootstrap_layout.rb

Instance Method Summary collapse

Methods included from BaseLayout

#calculate_layout, #input_width, #label_width, #layout_available?, #setup_config

Instance Method Details

#calc_actual_widthObject



14
15
16
# File 'lib/ext_form/layouts/bootstrap_layout.rb', line 14

def calc_actual_width
  self.layout_config[:max_width].to_i - 2 * self.layout_config[:spacing].to_i
end

#calculate_input_width(max_width, label_width, spacing, cols_sum, c) ⇒ Object



18
19
20
# File 'lib/ext_form/layouts/bootstrap_layout.rb', line 18

def calculate_input_width(max_width, label_width, spacing, cols_sum, c)
  (((max_width.to_f - spacing.to_f * 2) / cols_sum * c).floor - label_width.to_i).to_s
end

#measure_available?(measure) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/ext_form/layouts/bootstrap_layout.rb', line 10

def measure_available?(measure)
  true
end

#width_available?(width) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/ext_form/layouts/bootstrap_layout.rb', line 6

def width_available?(width)
  width && width.match(/^\d+$/) && width.to_i <= 12
end