Class: RubyUI::BulkActionTableActions

Inherits:
Base
  • Object
show all
Includes:
Phlex::Rails::Helpers::ButtonTo, Phlex::Rails::Helpers::LinkTo
Defined in:
lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_actions.rb

Constant Summary collapse

ACTION_BUTTON_CLASS =
"inline-flex items-center justify-center size-8 rounded-md transition-colors duration-150"
EDIT_CLASS =
"#{ACTION_BUTTON_CLASS} text-muted-foreground hover:text-foreground hover:bg-muted"
DELETE_CLASS =
"#{ACTION_BUTTON_CLASS} text-muted-foreground hover:text-destructive hover:bg-destructive/10 bg-transparent border-0 p-0 cursor-pointer"

Constants inherited from Base

RubyUI::Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(edit_path: nil, delete_path: nil, delete_confirm: nil, require_confirm: true, turbo_frame: nil, controller_name: nil, **user_attrs) ⇒ BulkActionTableActions

Returns a new instance of BulkActionTableActions.



12
13
14
15
16
17
18
19
20
21
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_actions.rb', line 12

def initialize(edit_path: nil, delete_path: nil, delete_confirm: nil, require_confirm: true,
               turbo_frame: nil, controller_name: nil, **user_attrs)
  @edit_path = edit_path
  @delete_path = delete_path
  @delete_confirm = delete_confirm
  @require_confirm = require_confirm
  @turbo_frame = turbo_frame
  @controller_name = controller_name || detect_controller_name
  super(**user_attrs)
end

Instance Method Details

#view_templateObject



23
24
25
26
27
28
29
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_actions.rb', line 23

def view_template(&)
  div(**attrs) do
    render_edit_button if @edit_path
    render_delete_button if @delete_path
    yield if block_given?
  end
end