Sha256: 967e4b306a5fb5d68f38fd0e886df9ab0de987952cb8f6867aab7a25c7ac06e8

Contents?: true

Size: 997 Bytes

Versions: 9

Compression:

Stored size: 997 Bytes

Contents

# frozen_string_literal: true

module BootstrapForm
  module Components
    module Layout
      extend ActiveSupport::Concern

      private

      def layout_default?(field_layout=nil)
        layout_in_effect(field_layout) == :default
      end

      def layout_horizontal?(field_layout=nil)
        layout_in_effect(field_layout) == :horizontal
      end

      def layout_inline?(field_layout=nil)
        layout_in_effect(field_layout) == :inline
      end

      def field_inline_override?(field_layout=nil)
        field_layout == :inline && layout != :inline
      end

      # true and false should only come from check_box and radio_button,
      # and those don't have a :horizontal layout
      def layout_in_effect(field_layout)
        field_layout = :inline if field_layout == true
        field_layout = :default if field_layout == false
        field_layout || layout
      end

      def get_group_layout(group_layout)
        group_layout || layout
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/bootstrap_form-4.5.0/lib/bootstrap_form/components/layout.rb
bootstrap_form-5.2.3 lib/bootstrap_form/components/layout.rb
bootstrap_form-5.2.2 lib/bootstrap_form/components/layout.rb
bootstrap_form-5.2.1 lib/bootstrap_form/components/layout.rb
bootstrap_form-5.2.0 lib/bootstrap_form/components/layout.rb
bootstrap_form-5.1.0 lib/bootstrap_form/components/layout.rb
bootstrap_form-5.0.0 lib/bootstrap_form/components/layout.rb
bootstrap_form-4.5.0 lib/bootstrap_form/components/layout.rb
bootstrap_form-4.4.0 lib/bootstrap_form/components/layout.rb