Sha256: a370179673b83cfb889017eae4122c31addf27228047eb6a11497a922247acf2
Contents?: true
Size: 988 Bytes
Versions: 25
Compression:
Stored size: 988 Bytes
Contents
require 'action_view/helpers/tags/placeholderable' module RedmineExtensions module Tags class AutocompleteField < ActionView::Helpers::Tags::Base include ActionView::Helpers::Tags::Placeholderable def initialize(object_name, method_name, template_object, choices, options, html_options) @choices = block_given? ? template_object.capture { yield || "" } : choices @choices = @choices.to_a if @choices.is_a?(Range) options[:multiple] = true unless options.key?(:multiple) @html_options = html_options super(object_name, method_name, template_object, html_options.merge(options)) end def render options = @options.stringify_keys options["value"] = options.fetch("value") { value_before_type_cast } add_default_name_and_id(options) @template_object.autocomplete_field_tag(options.delete('name'), @choices, options.delete('value'), options.symbolize_keys) end end end end
Version data entries
25 entries across 25 versions & 1 rubygems