Class: RubyUI::BulkActionTableDeleteModal

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_delete_modal.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(controller_name: "ruby-ui--bulk-action-table", **user_attrs) ⇒ BulkActionTableDeleteModal

Returns a new instance of BulkActionTableDeleteModal.



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

def initialize(controller_name: "ruby-ui--bulk-action-table", **user_attrs)
  @controller_name = controller_name
  super(**user_attrs)
end

Instance Method Details

#view_templateObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/generators/ruby_cms/templates/components/ruby_ui/bulk_action_table/bulk_action_table_delete_modal.rb', line 10

def view_template
  Modal(data: { "#{@controller_name}_target": "modalOverlay" }) do
    ModalContent(size: :sm, data: { "#{@controller_name}_target": "modalContent" }) do
      ModalHeader do
        ModalTitle(data: { "#{@controller_name}_target": "modalTitle" }) { "Delete Selected Items" }
      end

      div(
        data: { "#{@controller_name}_target": "modalMessage" },
        class: "text-center text-muted-foreground"
      ) do
        ModalDescription { "Are you sure you want to delete the selected items?" }
        ModalDescription(class: "mt-1 text-xs") { "This action cannot be undone." }
      end

      ModalFooter do
        ModalCancel(
          data: { action: "click->ruby-ui--modal#dismiss click->#{@controller_name}#closeModal" }
        ) { "Cancel" }

        ModalAction(
          data: {
            "#{@controller_name}_target": "modalConfirmButton",
            action: "click->#{@controller_name}#confirmAction"
          },
          class: "bg-destructive hover:bg-destructive/90 text-white font-bold hover:text-white-foreground",
          variant: :destructive
        ) { "Delete Selected" }
      end
    end
  end
end