Sha256: cdf3b7ecace2ca97234e6bc0e400a1bf59d48d1c66af6068ba5627208954d80d

Contents?: true

Size: 576 Bytes

Versions: 3

Compression:

Stored size: 576 Bytes

Contents

module SimpleForm
  module Components
    module Placeholders
      def placeholder
        disabled_placeholder
      end

      private

      def enabled_placeholder
        input_html_options[:placeholder] ||= placeholder_text if placeholder_present?
        nil
      end

      def disabled_placeholder
        nil
      end

      def placeholder_present?
        options[:placeholder] != false && placeholder_text.present?
      end

      def placeholder_text
        @placeholder_text ||= options[:placeholder] || translate(:placeholders)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
simple_form-1.5.2 lib/simple_form/components/placeholders.rb
simple_form-1.5.1 lib/simple_form/components/placeholders.rb
simple_form-1.5.0 lib/simple_form/components/placeholders.rb