Sha256: d80c3d9f2418f713e2b6cca87255a4665a7cb556e1a3057abc1276e90759cee2

Contents?: true

Size: 646 Bytes

Versions: 8

Compression:

Stored size: 646 Bytes

Contents

module SimpleForm
  module Components
    # Needs to be enabled in order to do automatic lookups
    module Tags
      # Name of the component method
      def tag(wrapper_options = nil)
        merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)

        text = merged_input_options[:text] == :label_text ? label_text : merged_input_options[:text]
        content_tag(merged_input_options[:tag], text, merged_input_options)
      end

      # Used when the number is optional
      def has_tag?
        tag.present?
      end
    end
  end
end

SimpleForm::Inputs::Base.send(:include, SimpleForm::Components::Tags)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
materialize-form-1.0.8 config/initializers/simple_form/tags_component.rb
materialize-form-1.0.7 config/initializers/simple_form/tags_component.rb
materialize-form-1.0.6 config/initializers/simple_form/tags_component.rb
materialize-form-1.0.5 config/initializers/simple_form/tags_component.rb
materialize-form-1.0.4 config/initializers/simple_form/tags_component.rb
materialize-form-1.0.3 config/initializers/simple_form/tags_component.rb
materialize-form-1.0.2 config/initializers/simple_form/tags_component.rb
materialize-form-1.0.1 config/initializers/simple_form/tags_component.rb