Module: RubyCms::BulkActionTableHelper

Defined in:
app/helpers/ruby_cms/bulk_action_table_helper.rb

Instance Method Summary collapse

Instance Method Details

#render_bulk_action_table_delete_dialog(controller_name: "ruby-cms--bulk-action-table") ⇒ String

Render the bulk action table delete dialog

Parameters:

  • (defaults to: "ruby-cms--bulk-action-table")

    The Stimulus controller name

Returns:

  • Rendered HTML for the delete dialog



8
9
10
11
# File 'app/helpers/ruby_cms/bulk_action_table_helper.rb', line 8

def render_bulk_action_table_delete_dialog(controller_name: "ruby-cms--bulk-action-table")
  render partial: "ruby_cms/admin/shared/bulk_action_table_delete_dialog",
         locals: { controller_name: }
end

#render_bulk_actions_bar(controller_name: "ruby-cms--bulk-action-table", item_name: "item", bulk_actions_url: nil, bulk_action_buttons: []) ⇒ Object

Render bulk actions bar

Parameters:

  • (defaults to: "ruby-cms--bulk-action-table")
  • (defaults to: "item")
  • (defaults to: nil)
  • (defaults to: [])


18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/ruby_cms/bulk_action_table_helper.rb', line 18

def render_bulk_actions_bar(
  controller_name: "ruby-cms--bulk-action-table",
  item_name: "item",
  bulk_actions_url: nil,
  bulk_action_buttons: []
)
   :div,
              data: { "#{controller_name}_target": "bulkBar" },
              class: "flex-shrink-0 hidden border border-gray-200
                bg-white px-4 py-2 shadow-md" do
     :div, class: "flex items-center justify-between max-w-full" do
      render_bulk_selection_info(controller_name:, item_name:) +
        render_bulk_action_buttons(controller_name:, bulk_action_buttons:, bulk_actions_url:)
    end
  end
end