Class: RedmineExtensions::Tags::AutocompleteField
- Inherits:
-
ActionView::Helpers::Tags::Base
- Object
- ActionView::Helpers::Tags::Base
- RedmineExtensions::Tags::AutocompleteField
- Includes:
- ActionView::Helpers::Tags::Placeholderable
- Defined in:
- lib/redmine_extensions/tags/autocomplete_field.rb
Instance Method Summary collapse
-
#initialize(object_name, method_name, template_object, choices, options, html_options) ⇒ AutocompleteField
constructor
A new instance of AutocompleteField.
- #render ⇒ Object
Constructor Details
#initialize(object_name, method_name, template_object, choices, options, html_options) ⇒ AutocompleteField
Returns a new instance of AutocompleteField.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/redmine_extensions/tags/autocomplete_field.rb', line 8 def initialize(object_name, method_name, template_object, choices, , ) @choices = block_given? ? template_object.capture { yield || "" } : choices @choices = @choices.to_a if @choices.is_a?(Range) [:multiple] = true unless .key?(:multiple) @html_options = super(object_name, method_name, template_object, .merge()) end |
Instance Method Details
#render ⇒ Object
19 20 21 22 23 24 |
# File 'lib/redmine_extensions/tags/autocomplete_field.rb', line 19 def render = @options.stringify_keys ["value"] = .fetch("value") { value_before_type_cast(object) } add_default_name_and_id() @template_object.autocomplete_field_tag(.delete('name'), @choices, .delete('value'), .symbolize_keys) end |