Class: CalendarComponent
- Defined in:
- app/components/calendar_component.rb
Overview
Calendar — date/time picker.
Usage:
Calendar(type: :date, name: "start_date")
Calendar(type: :datetime, format: "YYYY-MM-DD HH:mm")
Constant Summary
Constants inherited from Component
Instance Method Summary collapse
Methods inherited from Component
default, #initialize, #render_in, slot
Constructor Details
This class inherits a constructor from Component
Instance Method Details
#to_s ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'app/components/calendar_component.rb', line 16 def to_s data = { controller: "fui-calendar", fui_calendar_type_value: type } data[:fui_calendar_format_value] = format if format data[:fui_calendar_min_date_value] = min_date if min_date data[:fui_calendar_max_date_value] = max_date if max_date input_opts = { type: "text", placeholder: type } input_opts[:name] = name if name tag.div(class: "ui calendar", data: data) { tag.div(class: "ui input left icon") { safe_join([ tag.i(class: "calendar icon"), tag.input(**input_opts) ]) } } end |