Class: SolidWebUi::Ui::ActionButtonComponent

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/solid_web_ui/ui/action_button_component.rb

Overview

A button that performs a mutating action through a form (Rails button_to): retry/discard a job, pause/resume a queue, clear the cache, trim messages.

Always targets the top frame (data-turbo-frame=“_top”) so the action’s redirect/flash escapes the dashboard’s refresh turbo-frame. Pass danger: for destructive styling and confirm: for a Turbo confirmation dialog.

Instance Method Summary collapse

Constructor Details

#initialize(label:, url:, method: :post, danger: false, confirm: nil) ⇒ ActionButtonComponent

Returns a new instance of ActionButtonComponent.



12
13
14
15
16
17
18
# File 'app/components/solid_web_ui/ui/action_button_component.rb', line 12

def initialize(label:, url:, method: :post, danger: false, confirm: nil)
  @label = label
  @url = url
  @method = method
  @danger = danger
  @confirm = confirm
end