Sha256: 06dd8b6a11f69c361f6d2126cfd39b14c3d5dcf9bde18fb04f9a6daa56bf917d

Contents?: true

Size: 547 Bytes

Versions: 11

Compression:

Stored size: 547 Bytes

Contents

# frozen_string_literal: true
module SimpleForm
  module Components
    # Needs to be enabled in order to do automatic lookups.
    module Hints
      def hint(wrapper_options = nil)
        @hint ||= begin
          hint = options[:hint]

          if hint.is_a?(String)
            html_escape(hint)
          else
            content = translate_from_namespace(:hints)
            content.html_safe if content
          end
        end
      end

      def has_hint?
        options[:hint] != false && hint.present?
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

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