Sha256: 5b9a371b42aa615c6b5b115082a560f31c8be403b692851c0b79d388fb3f07b4

Contents?: true

Size: 657 Bytes

Versions: 14

Compression:

Stored size: 657 Bytes

Contents

module Headmin
  module Filter
    class SearchView < ViewModel
      def input_options
        keys = attributes - %i[params]
        options = to_h.slice(*keys)
        options = default_input_options.merge(options)
        options.merge(label: false)
      end

      private

      def default_input_options
        {
          name: name,
          value: params[name],
          wrapper: false,
          placeholder: placeholder
        }
      end

      def name
        @name || attribute || :search
      end

      def placeholder
        @placeholder || I18n.t("headmin.filters.search.placeholder", resource: label)
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
headmin-0.6.3 app/models/headmin/filter/search_view.rb
headmin-0.6.2 app/models/headmin/filter/search_view.rb
headmin-0.6.1 app/models/headmin/filter/search_view.rb
headmin-0.6.0 app/models/headmin/filter/search_view.rb
headmin-0.5.9 app/models/headmin/filter/search_view.rb
headmin-0.5.8 app/models/headmin/filter/search_view.rb
headmin-0.5.7 app/models/headmin/filter/search_view.rb
headmin-0.5.6 app/models/headmin/filter/search_view.rb
headmin-0.5.5 app/models/headmin/filter/search_view.rb
headmin-0.5.4 app/models/headmin/filter/search_view.rb
headmin-0.5.3 app/models/headmin/filter/search_view.rb
headmin-0.5.2 app/models/headmin/filter/search_view.rb
headmin-0.5.1 app/models/headmin/filter/search_view.rb
headmin-0.5.0 app/models/headmin/filter/search_view.rb