Class: Panda::Core::Admin::FormSelectComponent
- Inherits:
-
Base
- Object
- Phlex::HTML
- Base
- Panda::Core::Admin::FormSelectComponent
show all
- Defined in:
- app/components/panda/core/admin/form_select_component.rb
Constant Summary
Constants inherited
from Base
Base::TAILWIND_MERGER
Instance Method Summary
collapse
Methods inherited from Base
#after_template, #attrs, #before_template, #merge_attrs, #tailwind_merge_attrs
Instance Method Details
#default_attrs ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/components/panda/core/admin/form_select_component.rb', line 23
def default_attrs
base_attrs = {
name: @name,
id: @name.to_s.gsub(/[\[\]]/, "_").gsub("__", "_").chomp("_"),
class: select_classes
}
base_attrs[:required] = true if @required
base_attrs[:disabled] = true if @disabled
base_attrs
end
|
#view_template ⇒ Object
15
16
17
18
19
20
21
|
# File 'app/components/panda/core/admin/form_select_component.rb', line 15
def view_template
select(**@attrs) do
render_prompt if @prompt
render_blank if @include_blank && !@prompt
render_options
end
end
|