Class: Panda::Core::Admin::DeleteButtonComponent
- Defined in:
- app/components/panda/core/admin/delete_button_component.rb
Overview
Renders a right-aligned delete button using button_to with DELETE method
and a Turbo confirmation dialog.
Lives in panda-core because every admin app needs destructive action buttons,
and the existing ButtonComponent renders <a> tags rather than <form>-based
button_to elements required for safe DELETE requests (CSRF + method override).
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#confirm ⇒ Object
readonly
Returns the value of attribute confirm.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text:, path:, confirm:, **attrs) ⇒ DeleteButtonComponent
constructor
A new instance of DeleteButtonComponent.
Constructor Details
#initialize(text:, path:, confirm:, **attrs) ⇒ DeleteButtonComponent
Returns a new instance of DeleteButtonComponent.
22 23 24 25 26 27 |
# File 'app/components/panda/core/admin/delete_button_component.rb', line 22 def initialize(text:, path:, confirm:, **attrs) @text = text @path = path @confirm = confirm super(**attrs) end |
Instance Attribute Details
#confirm ⇒ Object (readonly)
Returns the value of attribute confirm.
20 21 22 |
# File 'app/components/panda/core/admin/delete_button_component.rb', line 20 def confirm @confirm end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
20 21 22 |
# File 'app/components/panda/core/admin/delete_button_component.rb', line 20 def path @path end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
20 21 22 |
# File 'app/components/panda/core/admin/delete_button_component.rb', line 20 def text @text end |