Class: ActionView::Helpers::InstanceTag

Inherits:
Object
  • Object
show all
Includes:
ActiveModelInstanceTag, FormOptionsHelper, InstanceTagMethods
Defined in:
lib/action_view/helpers/date_helper.rb,
lib/action_view/helpers/form_helper.rb,
lib/action_view/helpers/active_model_helper.rb,
lib/action_view/helpers/form_options_helper.rb

Overview

:nodoc:

Constant Summary

Constants included from InstanceTagMethods

ActionView::Helpers::InstanceTagMethods::DEFAULT_FIELD_OPTIONS, ActionView::Helpers::InstanceTagMethods::DEFAULT_RADIO_OPTIONS, ActionView::Helpers::InstanceTagMethods::DEFAULT_TEXT_AREA_OPTIONS

Constants included from TagHelper

TagHelper::BOOLEAN_ATTRIBUTES

Instance Attribute Summary

Attributes included from InstanceTagMethods

#method_name, #object_name

Attributes included from Context

#output_buffer

Instance Method Summary collapse

Methods included from FormOptionsHelper

#collection_select, #grouped_collection_select, #grouped_options_for_select, #option_groups_from_collection_for_select, #options_for_select, #options_from_collection_for_select, #select, #time_zone_options_for_select, #time_zone_select

Methods included from TextHelper

#auto_link, #concat, #current_cycle, #cycle, #excerpt, #highlight, #pluralize, #reset_cycle, #safe_concat, #simple_format, #truncate, #word_wrap

Methods included from SanitizeHelper

#sanitize, #sanitize_css, #strip_links, #strip_tags

Methods included from ActiveModelInstanceTag

#error_message, #error_wrapping, #object, #tag

Methods included from InstanceTagMethods

#initialize, #object, #to_boolean_select_tag, #to_check_box_tag, #to_content_tag, #to_input_field_tag, #to_label_tag, #to_number_field_tag, #to_radio_button_tag, #to_text_area_tag, #value, #value_before_type_cast

Methods included from CaptureHelper

#capture, #content_for, #content_for?, #flush_output_buffer, #with_output_buffer

Methods included from Context

#convert_to_model

Methods included from TagHelper

#cdata_section, #content_tag, #escape_once, #tag

Methods included from FormTagHelper

#check_box_tag, #email_field_tag, #field_set_tag, #file_field_tag, #form_tag, #hidden_field_tag, #image_submit_tag, #label_tag, #number_field_tag, #password_field_tag, #radio_button_tag, #range_field_tag, #search_field_tag, #select_tag, #submit_tag, #telephone_field_tag, #text_area_tag, #text_field_tag, #url_field_tag

Methods included from UrlHelper

#button_to, #current_page?, #link_to, #link_to_if, #link_to_unless, #link_to_unless_current, #mail_to, #url_for, #url_options

Methods included from ActionDispatch::Routing::UrlFor

#url_for, #url_options

Methods included from ActionDispatch::Routing::PolymorphicRoutes

#polymorphic_path, #polymorphic_url

Instance Method Details

#to_collection_select_tag(collection, value_method, text_method, options, html_options) ⇒ Object



564
565
566
567
568
569
570
571
572
573
# File 'lib/action_view/helpers/form_options_helper.rb', line 564

def to_collection_select_tag(collection, value_method, text_method, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  disabled_value = options.has_key?(:disabled) ? options[:disabled] : nil
  selected_value = options.has_key?(:selected) ? options[:selected] : value
  (
    "select", add_options(options_from_collection_for_select(collection, value_method, text_method, :selected => selected_value, :disabled => disabled_value), options, value), html_options
  )
end

#to_date_select_tag(options = {}, html_options = {}) ⇒ Object



911
912
913
# File 'lib/action_view/helpers/date_helper.rb', line 911

def to_date_select_tag(options = {}, html_options = {})
  datetime_selector(options, html_options).select_date.html_safe
end

#to_datetime_select_tag(options = {}, html_options = {}) ⇒ Object



919
920
921
# File 'lib/action_view/helpers/date_helper.rb', line 919

def to_datetime_select_tag(options = {}, html_options = {})
  datetime_selector(options, html_options).select_datetime.html_safe
end

#to_grouped_collection_select_tag(collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options) ⇒ Object



575
576
577
578
579
580
581
582
# File 'lib/action_view/helpers/form_options_helper.rb', line 575

def to_grouped_collection_select_tag(collection, group_method, group_label_method, option_key_method, option_value_method, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  (
    "select", add_options(option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, value), options, value), html_options
  )
end

#to_select_tag(choices, options, html_options) ⇒ Object



555
556
557
558
559
560
561
562
# File 'lib/action_view/helpers/form_options_helper.rb', line 555

def to_select_tag(choices, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  selected_value = options.has_key?(:selected) ? options[:selected] : value
  disabled_value = options.has_key?(:disabled) ? options[:disabled] : nil
  ("select", add_options(options_for_select(choices, :selected => selected_value, :disabled => disabled_value), options, selected_value), html_options)
end

#to_time_select_tag(options = {}, html_options = {}) ⇒ Object



915
916
917
# File 'lib/action_view/helpers/date_helper.rb', line 915

def to_time_select_tag(options = {}, html_options = {})
  datetime_selector(options, html_options).select_time.html_safe
end

#to_time_zone_select_tag(priority_zones, options, html_options) ⇒ Object



584
585
586
587
588
589
590
591
592
593
594
# File 'lib/action_view/helpers/form_options_helper.rb', line 584

def to_time_zone_select_tag(priority_zones, options, html_options)
  html_options = html_options.stringify_keys
  add_default_name_and_id(html_options)
  value = value(object)
  ("select",
    add_options(
      time_zone_options_for_select(value || options[:default], priority_zones, options[:model] || ActiveSupport::TimeZone),
      options, value
    ), html_options
  )
end