Class: RubyCms::Admin::BulkActionTable::BulkActionTableActions

Inherits:
RubyCms::Admin::BaseComponent show all
Defined in:
app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_actions.rb

Overview

Row action buttons component Renders Edit and Delete buttons for each table row

Instance Method Summary collapse

Methods inherited from RubyCms::Admin::BaseComponent

#build_classes, #conditional_attributes, #controller, #form_authenticity_token, #helpers, #merge_data_attributes, #token_from_controller, #token_from_controller?, #token_from_helpers?

Constructor Details

#initialize(delete_path:, item_id:, edit_path: nil, delete_confirm: "Are you sure you want to delete this item?", require_confirm: true, turbo_frame: nil, controller_name: "ruby-cms--bulk-action-table") ⇒ BulkActionTableActions

Returns a new instance of BulkActionTableActions.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_actions.rb', line 16

def initialize(
  delete_path:,
  item_id:,
  edit_path: nil,
  delete_confirm: "Are you sure you want to delete this item?",
  require_confirm: true,
  turbo_frame: nil,
  controller_name: "ruby-cms--bulk-action-table"
)
  super
  @edit_path = edit_path
  @delete_path = delete_path
  @item_id = item_id
  @delete_confirm = delete_confirm
  @require_confirm = require_confirm
  @turbo_frame = turbo_frame
  @controller_name = controller_name
end

Instance Method Details

#view_templateObject



35
36
37
38
39
40
41
# File 'app/components/ruby_cms/admin/bulk_action_table/bulk_action_table_actions.rb', line 35

def view_template
  div(class: "flex items-center justify-end gap-1 pr-2") do
    render_edit_button if @edit_path

    render_delete_button if @delete_path
  end
end