Module: ActionView::Helpers::FormOptionsHelper
- Included in:
- InstanceTag
- Defined in:
- lib/config/initializers/intl_select.rb,
lib/config/initializers/intl_select.rb
Instance Method Summary collapse
- #intl_options_for_select(container, selected = nil) ⇒ Object
- #intl_select(object, method, choices, options = {}, html_options = {}) ⇒ Object
Instance Method Details
#intl_options_for_select(container, selected = nil) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/config/initializers/intl_select.rb', line 11 def (container, selected = nil) container = container.to_a if Hash === container = container.inject([]) do |, element| text, value = option_text_and_value(element) selected_attribute = ' selected="selected"' if option_value_selected?(value, selected) << %(<option value="#{html_escape(value.to_s)}"#{selected_attribute}><fw:intl>#{html_escape(text.to_s)}</fw:intl></option>) end .join("\n") end |
#intl_select(object, method, choices, options = {}, html_options = {}) ⇒ Object
22 23 24 |
# File 'lib/config/initializers/intl_select.rb', line 22 def intl_select(object, method, choices, = {}, = {}) InstanceTag.new(object, method, self, nil, .delete(:object)).to_intl_select_tag(choices, , ) end |