Sha256: 21f48dc350c642ed9f573d6502f9dfe4f4186e21ed45e390d41561a8c3d62c0c
Contents?: true
Size: 828 Bytes
Versions: 16
Compression:
Stored size: 828 Bytes
Contents
module Formstrap module Autocompletable extend ActiveSupport::Concern included do def autocomplete? collection.is_a?(String) || collection.is_a?(Array) end def autocomplete_options { collection: collection.is_a?(Array) ? collection : [] } end def autocomplete_input_options { data: { autocomplete_target: autocomplete? ? "input" : nil } } end def autocomplete_input_group_options options = { data: { controller: autocomplete? ? "autocomplete" : nil, autocomplete_url_value: collection.is_a?(String) ? collection : nil } } options = options.merge(bypass: false) if autocomplete? options end end end end
Version data entries
16 entries across 16 versions & 1 rubygems