Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change confirmation message on delete action on show page in active admin rails 4

In my application, i need to change the default confirmation message on delete action. I have changed the default confirmation message for delete action on index page like,

index do
  column :title
  column :start_date
  column :start_time
  column :end_date
  column :end_time

  #actions
  actions defaults: false do |post|
    item "View", admin_content_path(post)
    text_node "&nbsp".html_safe
    item "Edit", edit_admin_content_path(post)
    text_node "&nbsp".html_safe
    item "Delete", admin_content_path(post), method: :delete, :confirm => "All grades, uploads and tracks will be deleted with this content.Are you sure you want to delete this Content?"
end

end

This is working fine on index page. I want to change the default confirmation message of delete action on show page also. It still showing default message like 'Are you sure you want to delete this?'

And how to change css of the confirmation dialog box of batch action in activeadmin?

Anyone know about this? Thanks.

like image 389
rick Avatar asked Jan 07 '23 13:01

rick


1 Answers

First, you need to turn off the default generated links, you should use:

  config.clear_action_items!

Then, you can create your own action items like this:

  action_item only: :show  do
    link_to "Delete", { action: :destroy }, method: :delete, data: { confirm: 'All grades, uploads and tracks will be deleted with this content.Are you sure you want to delete this Content?' }
  end
like image 55
Andrey Deineko Avatar answered Jan 25 '23 00:01

Andrey Deineko