Class: FormProps::Inputs::WeekdaySelect

Inherits:
Base
  • Object
show all
Includes:
ActionView::Helpers::FormOptionsHelper, ActionView::Helpers::Tags::SelectRenderer, FormOptionsHelper, SelectRenderer
Defined in:
lib/form_props/inputs/weekday_select.rb

Instance Method Summary collapse

Methods included from SelectRenderer

#add_options, #select_content_props

Methods included from FormOptionsHelper

#extract_selected_and_disabled, #extract_values_from_collection, #grouped_options_for_select, #option_groups_from_collection_for_select, #option_html_attributes, #options_for_select, #options_from_collection_for_select, #selected_values, #time_zone_options_for_select, #value_for_collection, #weekday_options_for_select

Methods inherited from Base

#json

Constructor Details

#initialize(object_name, method_name, template_object, options, html_options) ⇒ WeekdaySelect

Returns a new instance of WeekdaySelect.



13
14
15
16
17
# File 'lib/form_props/inputs/weekday_select.rb', line 13

def initialize(object_name, method_name, template_object, options, html_options)
  @html_options = html_options

  super(object_name, method_name, template_object, options)
end

Instance Method Details

#renderObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/form_props/inputs/weekday_select.rb', line 19

def render
  select_content_props(
    weekday_options_for_select(
      value || @options[:selected],
      index_as_value: @options.fetch(:index_as_value, false),
      day_format: @options.fetch(:day_format, :day_names),
      beginning_of_week: @options.fetch(:beginning_of_week, Date.beginning_of_week)
    ),
    @options,
    @html_options
  )
end