Sha256: b6af7c95e9478f53b092d47de43b8ecc661265848c3352dbe49c31bfb73c5fd7

Contents?: true

Size: 842 Bytes

Versions: 10

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true
module SimpleForm
  module Components
    module LabelInput
      extend ActiveSupport::Concern

      included do
        include SimpleForm::Components::Labels
      end

      def label_input(wrapper_options = nil)
        if options[:label] == false
          deprecated_component(:input, wrapper_options)
        else
          deprecated_component(:label, wrapper_options) + deprecated_component(:input, wrapper_options)
        end
      end

      private

      def deprecated_component(namespace, wrapper_options)
        method = method(namespace)

        if method.arity.zero?
          ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })

          method.call
        else
          method.call(wrapper_options)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
simple_form-5.2.0 lib/simple_form/components/label_input.rb
simple_form-5.1.0 lib/simple_form/components/label_input.rb
simple_form-5.0.3 lib/simple_form/components/label_input.rb
simple_form-5.0.2 lib/simple_form/components/label_input.rb
simple_form-5.0.1 lib/simple_form/components/label_input.rb
simple_form-5.0.0 lib/simple_form/components/label_input.rb
simple_form-4.1.0 lib/simple_form/components/label_input.rb
simple_form-4.0.1 lib/simple_form/components/label_input.rb
simple_form-4.0.0 lib/simple_form/components/label_input.rb
simple_form-3.5.1 lib/simple_form/components/label_input.rb