Class: ActionView::Helpers::Tags::DateSelect
| Relationships & Source Files | |
| Extension / Inclusion / Inheritance Descendants | |
|
Subclasses:
|
|
| Super Chains via Extension / Inclusion / Inheritance | |
|
Class Chain:
self,
Base
|
|
|
Instance Chain:
self,
SelectRenderer,
Base,
::ActionView::Helpers::ActiveModelInstanceTag,
::ActionView::Helpers::FormTagHelper,
::ActionView::Helpers::TextHelper,
::ActionView::Helpers::SanitizeHelper,
::ActionView::Helpers::UrlHelper,
::ActionView::Helpers::ContentExfiltrationPreventionHelper,
::ActionView::Helpers::TagHelper,
::ActionView::Helpers::OutputSafetyHelper,
::ActionView::Helpers::CaptureHelper
|
|
| Inherits: |
ActionView::Helpers::Tags::Base
|
| Defined in: | actionview/lib/action_view/helpers/tags/date_select.rb |
Constant Summary
::ActionView::Helpers::TagHelper - Included
ARIA_PREFIXES, BOOLEAN_ATTRIBUTES, DATA_PREFIXES, PRE_CONTENT_STRINGS, TAG_TYPES
::ActionView::Helpers::ContentExfiltrationPreventionHelper - Included
CLOSE_CDATA_COMMENT, CLOSE_FORM_TAG, CLOSE_OPTION_TAG, CLOSE_QUOTES_COMMENT, CONTENT_EXFILTRATION_PREVENTION_MARKUP
::ActionView::Helpers::UrlHelper - Included
Class Method Summary
- .new(object_name, method_name, template_object, options, html_options) ⇒ DateSelect constructor
- .select_type
Base - Inherited
Instance Attribute Summary
Base - Inherited
::ActionView::Helpers::ActiveModelInstanceTag - Included
::ActionView::Helpers::FormTagHelper - Included
::ActionView::Helpers::SanitizeHelper - Included
::ActionView::Helpers::UrlHelper - Included
::ActionView::Helpers::ContentExfiltrationPreventionHelper - Included
Instance Method Summary
- #render
- #datetime_selector(options, html_options) private
- #default_datetime(options) private
- #select_type private
SelectRenderer - Included
Base - Inherited
| #render | This is what child classes implement. |
| #add_default_name_and_field, #add_default_name_and_field_for_value, | |
| #add_default_name_and_id | Alias for Base#add_default_name_and_field. |
| #add_default_name_and_id_for_value | Alias for Base#add_default_name_and_field_for_value. |
| #name_and_id_index, #retrieve_autoindex, #retrieve_object, #sanitized_method_name, #sanitized_value, #tag_id, #tag_name, #value, #value_before_type_cast | |
::ActionView::Helpers::ActiveModelInstanceTag - Included
| #content_tag, #error_message, #error_wrapping, #object, #tag, #select_markup_helper?, #tag_generate_errors? |
::ActionView::Helpers::FormTagHelper - Included
| #button_tag | Creates a button element that defines a |
| #check_box_tag | Alias for FormTagHelper#checkbox_tag. |
| #checkbox_tag | Creates a check box form input tag. |
| #color_field_tag | Creates a text field of type “color”. |
| #date_field_tag | Creates a text field of type “date”. |
| #datetime_field_tag | Creates a text field of type “datetime-local”. |
| #datetime_local_field_tag | Alias for FormTagHelper#datetime_field_tag. |
| #email_field_tag | Creates a text field of type “email”. |
| #field_id | Generate an HTML |
| #field_name | Generate an HTML |
| #field_set_tag | Creates a field set for grouping HTML form elements. |
| #fieldset_tag | Alias for FormTagHelper#field_set_tag. |
| #file_field_tag | Creates a file upload field. |
| #form_tag | Starts a form tag that points the action to a URL configured with |
| #hidden_field_tag | Creates a hidden form input field used to transmit data that would be lost due to HTTP’s statelessness or data that should be hidden from the user. |
| #image_submit_tag | Displays an image which when clicked will submit the form. |
| #label_tag | Creates a label element. |
| #month_field_tag | Creates a text field of type “month”. |
| #number_field_tag | Creates a number field. |
| #password_field_tag | Creates a password field, a masked text field that will hide the users input behind a mask character. |
| #phone_field_tag | Alias for FormTagHelper#telephone_field_tag. |
| #radio_button_tag | Creates a radio button; use groups of radio buttons named the same to allow users to select from a group of options. |
| #range_field_tag | Creates a range form element. |
| #search_field_tag | Creates a text field of type “search”. |
| #select_tag | Creates a dropdown selection box, or if the |
| #submit_tag | Creates a submit button with the text |
| #telephone_field_tag | Creates a text field of type “tel”. |
| #text_area_tag | Alias for FormTagHelper#textarea_tag. |
| #text_field_tag | Creates a standard text field; use these text fields to input smaller chunks of text like a username or a search query. |
| #textarea_tag | Creates a text input area; use a textarea for longer text inputs such as blog posts or descriptions. |
| #time_field_tag | Creates a text field of type “time”. |
| #url_field_tag | Creates a text field of type “url”. |
| #utf8_enforcer_tag | Creates the hidden UTF-8 enforcer tag. |
| #week_field_tag | Creates a text field of type “week”. |
| #convert_direct_upload_option_to_url, #extra_tags_for_form, #form_tag_html, #form_tag_with_body, #html_options_for_form, | |
| #sanitize_to_id | |
| #set_default_disable_with | |
::ActionView::Helpers::TextHelper - Included
| #concat | The preferred method of outputting text in your views is to use the |
| #current_cycle | Returns the current cycle string after a cycle has been started. |
| #cycle | Creates a Cycle object whose |
| #excerpt | Extracts the first occurrence of |
| #highlight | Highlights occurrences of |
| #pluralize | Attempts to pluralize the |
| #reset_cycle | Resets a cycle so that it starts from the first element the next time it is called. |
| #safe_concat, | |
| #simple_format | Returns |
| #truncate | Truncates |
| #word_wrap | Wraps the |
| #cut_excerpt_part, | |
| #get_cycle | The cycle helpers need to store the cycles in a place that is guaranteed to be reset every time a page is rendered, so it uses an instance variable of |
| #set_cycle, #split_paragraphs | |
::ActionView::Helpers::SanitizeHelper - Included
| #sanitize | Sanitizes HTML input, stripping all but known-safe tags and attributes. |
| #sanitize_css | Sanitizes a block of CSS code. |
| #strip_links | Strips all link tags from |
| #strip_tags | Strips all HTML tags from |
::ActionView::Helpers::UrlHelper - Included
| #button_to | Generates a form containing a single button that submits to the URL created by the set of |
| #current_page? | True if the current request URI was generated by the given |
| #link_to | Creates an anchor element of the given |
| #link_to_if | Creates a link tag of the given |
| #link_to_unless | Creates a link tag of the given |
| #link_to_unless_current | Creates a link tag of the given |
| #mail_to | Creates a mailto link tag to the specified |
| #phone_to | Creates a TEL anchor link tag to the specified |
| #sms_to | Creates an SMS anchor link tag to the specified |
| #add_method_to_attributes!, #convert_options_to_data_attributes, #link_to_remote_options?, #method_for_options, #method_not_get_method?, #method_tag, #remove_trailing_slash!, | |
| #to_form_params | Returns an array of hashes each containing |
| #token_tag, #url_target, | |
| #url_for | Basic implementation of url_for to allow use helpers without routes existence. |
| #_back_url, #_filtered_referrer | |
::ActionView::Helpers::ContentExfiltrationPreventionHelper - Included
::ActionView::Helpers::TagHelper - Included
| #cdata_section | Returns a CDATA section with the given |
| #class_names | Alias for ActionView::Helpers::TagHelper#token_list. |
| #content_tag | Returns an HTML block tag of type |
| #escape_once | Returns an escaped version of |
| #tag | Returns an HTML tag. |
| #token_list | Returns a string of tokens built from |
| #build_tag_values, #ensure_valid_html5_tag_name, #tag_builder | |
::ActionView::Helpers::OutputSafetyHelper - Included
| #raw | This method outputs without escaping a string. |
| #safe_join | This method returns an HTML safe string similar to what |
| #to_sentence | Converts the array to a comma-separated sentence where the last element is joined by the connector word. |
::ActionView::Helpers::CaptureHelper - Included
| #capture | The capture method extracts part of a template as a string object. |
| #content_for | Calling |
| #content_for? |
|
| #provide | The same as |
| #with_output_buffer | Use an alternate output buffer for the duration of the block. |
Constructor Details
.new(object_name, method_name, template_object, options, html_options) ⇒ DateSelect
# File 'actionview/lib/action_view/helpers/tags/date_select.rb', line 11
def initialize(object_name, method_name, template_object, , ) @html_options = super(object_name, method_name, template_object, ) end
Class Method Details
.select_type
[ GitHub ]# File 'actionview/lib/action_view/helpers/tags/date_select.rb', line 22
def select_type @select_type ||= name.split("::").last.sub("Select", "").downcase end
Instance Method Details
#datetime_selector(options, html_options) (private)
[ GitHub ]# File 'actionview/lib/action_view/helpers/tags/date_select.rb', line 32
def datetime_selector(, ) datetime = .fetch(:selected) { value || default_datetime() } @auto_index ||= nil = .dup [:field_name] = @method_name [:include_position] = true [:prefix] ||= @object_name [:index] = @auto_index if @auto_index && !.has_key?(:index) DateTimeSelector.new(datetime, , ) end
#default_datetime(options) (private)
[ GitHub ]# File 'actionview/lib/action_view/helpers/tags/date_select.rb', line 45
def default_datetime() return if [:include_blank] || [:prompt] case [:default] when nil Time.current when Date, Time [:default] else default = [:default].dup # Rename :minute and :second to :min and :sec default[:min] ||= default[:minute] default[:sec] ||= default[:second] time = Time.current [:year, :month, :day, :hour, :min, :sec].each do |key| default[key] ||= time.public_send(key) end Time.utc( default[:year], default[:month], default[:day], default[:hour], default[:min], default[:sec] ) end end
#render
[ GitHub ]# File 'actionview/lib/action_view/helpers/tags/date_select.rb', line 17
def render error_wrapping(datetime_selector(@options, @html_options).public_send("select_#{select_type}").html_safe) end
#select_type (private)
[ GitHub ]# File 'actionview/lib/action_view/helpers/tags/date_select.rb', line 28
def select_type self.class.select_type end