Sha256: ccf113bfd8cbce37249904ecd78fbc4257bc6ee9fa75019023eb8ba0a645dac0

Contents?: true

Size: 570 Bytes

Versions: 2

Compression:

Stored size: 570 Bytes

Contents

module ExtForm
  module Layouts
    class BootstrapLayout
      include BaseLayout

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

      def measure_available?(measure)
        true
      end

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

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ext_form-0.1.5 lib/ext_form/layouts/bootstrap_layout.rb
ext_form-0.1.4 lib/ext_form/layouts/bootstrap_layout.rb