class ExtForm::Layouts::DefaultLayout
Public Instance Methods
calc_actual_width()
click to toggle source
# File lib/ext_form/layouts/default_layout.rb, line 20 def calc_actual_width self.layout.flatten.map(&:to_f).sum end
calculate_input_width(max_width, label_width, spacing, cols_sum, c)
click to toggle source
# File lib/ext_form/layouts/default_layout.rb, line 24 def calculate_input_width(max_width, label_width, spacing, cols_sum, c) ((max_width.to_f - 2 * spacing.to_f) / cols_sum * c - label_width.to_f).to_s end
measure_available?(measure)
click to toggle source
# File lib/ext_form/layouts/default_layout.rb, line 16 def measure_available?(measure) %w(% px pt em cm).include?(measure) end
width_available?(width)
click to toggle source
Internal: decide option width whether is available, possible formats are number% or number.
width - option width
Returns true or false.
# File lib/ext_form/layouts/default_layout.rb, line 12 def width_available?(width) width && width.match(/^\d+\.?\d?$/) end