Class: UI::CalendarComponent
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- UI::CalendarComponent
- Includes:
- CalendarBehavior
- Defined in:
- app/view_components/ui/calendar_component.rb
Overview
Calendar component (ViewComponent) A date picker calendar with support for single, range, and multiple selection
Constant Summary
Constants included from CalendarBehavior
UI::CalendarBehavior::WEEKDAYS
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(mode: :single, selected: nil, month: Date.today, number_of_months: 1, week_starts_on: 0, locale: "en-US", min_date: nil, max_date: nil, disabled_dates: [], show_outside_days: true, fixed_weeks: false, show_dropdowns: false, year_range: 100, min_range_days: 0, max_range_days: 0, exclude_disabled: false, use_native_select: true, name: nil, classes: "", attributes: {}) ⇒ CalendarComponent
constructor
A new instance of CalendarComponent.
Methods included from CalendarBehavior
#aria_label_text, #calendar_classes, #calendar_data_attributes, #calendar_html_attributes, #disabled_dates_json, #ordered_weekdays, #selected_json, #selected_value, #use_native_select?
Constructor Details
#initialize(mode: :single, selected: nil, month: Date.today, number_of_months: 1, week_starts_on: 0, locale: "en-US", min_date: nil, max_date: nil, disabled_dates: [], show_outside_days: true, fixed_weeks: false, show_dropdowns: false, year_range: 100, min_range_days: 0, max_range_days: 0, exclude_disabled: false, use_native_select: true, name: nil, classes: "", attributes: {}) ⇒ CalendarComponent
Returns a new instance of CalendarComponent.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/view_components/ui/calendar_component.rb', line 8 def initialize( mode: :single, selected: nil, month: Date.today, number_of_months: 1, week_starts_on: 0, locale: "en-US", min_date: nil, max_date: nil, disabled_dates: [], show_outside_days: true, fixed_weeks: false, show_dropdowns: false, year_range: 100, min_range_days: 0, max_range_days: 0, exclude_disabled: false, use_native_select: true, name: nil, classes: "", attributes: {} ) @mode = mode @selected = selected @month = month @number_of_months = number_of_months @week_starts_on = week_starts_on @locale = locale @min_date = min_date @max_date = max_date @disabled_dates = disabled_dates @show_outside_days = show_outside_days @fixed_weeks = fixed_weeks @show_dropdowns = show_dropdowns @year_range = year_range @min_range_days = min_range_days @max_range_days = max_range_days @exclude_disabled = exclude_disabled @use_native_select = use_native_select @name = name @classes = classes @attributes = attributes super() end |
Instance Method Details
#call ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'app/view_components/ui/calendar_component.rb', line 53 def call content_tag(:div, **calendar_html_attributes) do safe_join([ live_region_html, hidden_input, months_html ].compact) end end |