Class: Components::Databasium::TypeSelect
- Defined in:
- app/components/databasium/type_select.rb
Instance Method Summary collapse
-
#initialize(name: nil, value: nil) ⇒ TypeSelect
constructor
A new instance of TypeSelect.
- #view_template ⇒ Object
Methods inherited from Base
Methods included from Databasium::HeroiconHelper
Constructor Details
#initialize(name: nil, value: nil) ⇒ TypeSelect
Returns a new instance of TypeSelect.
6 7 8 9 |
# File 'app/components/databasium/type_select.rb', line 6 def initialize(name: nil, value: nil) @name = name @value = value end |
Instance Method Details
#view_template ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/components/databasium/type_select.rb', line 11 def view_template select( name: @name, class: "border-2 rounded-xl px-2 py-1 border-border h-full bg-background focus:outline-none" ) do [ %w[text Text], %w[string String], %w[integer Integer], %w[float Float], %w[decimal Decimal], %w[time Time], %w[date Date], %w[datetime Datetime], %w[timestamp Timestamp], %w[binary Binary], %w[boolean Boolean], %w[references Reference] ].each { |value, label| option(value: value, selected: @value == value) { label } } end end |