Class: RubyUI::BulkActionButton

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_button.rb

Constant Summary

Constants inherited from Base

RubyUI::Base::TAILWIND_MERGER

Instance Attribute Summary

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Constructor Details

#initialize(button_config:, controller_name:, require_confirm: true, **user_attrs) ⇒ BulkActionButton

Returns a new instance of BulkActionButton.



5
6
7
8
9
10
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_button.rb', line 5

def initialize(button_config:, controller_name:, require_confirm: true, **user_attrs)
  @button_config = button_config
  @controller_name = controller_name
  @require_confirm = require_confirm
  super(**user_attrs)
end

Instance Method Details

#view_templateObject



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

def view_template
  Button(
    variant: :outline,
    type: "button",
    data: build_button_data,
    **(@button_config[:class] ? { class: @button_config[:class] } : {})
  ) do
    plain label
  end
end