Class: ActionView::Helpers::Tags::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/carmen/rails/action_view/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#to_region_select_tag(parent_region, options = {}, html_options = {}) ⇒ Object


203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/carmen/rails/action_view/form_helper.rb', line 203

def to_region_select_tag(parent_region, options = {}, html_options = {})
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  options[:include_blank] ||= true unless options[:prompt] || select_not_required?(html_options)

  value = options[:selected] ? options[:selected] : value(object)
  priority_regions = options[:priority] || []
  opts = add_options(region_options_for_select(parent_region.subregions, value, 
                                              :priority => priority_regions), 
                     options, value)
  select = ("select", opts, html_options)
  if html_options["multiple"] && options.fetch(:include_hidden, true)
    tag("input", :disabled => html_options["disabled"], :name => html_options["name"], 
                 :type => "hidden", :value => "") + select
  else
    select
  end
end