在活动管理栏4中的显示页面上更改有关删除操作的确认消息

ric*_*ick 1 ruby-on-rails activeadmin ruby-on-rails-4

在我的应用程序中,我需要更改删除操作的默认确认消息.我已在索引页面上更改了删除操作的默认确认消息,例如

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
Run Code Online (Sandbox Code Playgroud)

结束

这在索引页面上工作正常.我想在显示页面上更改删除操作的默认确认消息.它仍显示默认消息,例如"您确定要删除此内容吗?"

如何在activeadmin中更改批量操作确认对话框的css?

有人知道吗?谢谢.

And*_*eko 5

首先,您需要关闭默认生成的链接,您应该使用:

  config.clear_action_items!
Run Code Online (Sandbox Code Playgroud)

然后,您可以创建自己的操作项,如下所示:

  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
Run Code Online (Sandbox Code Playgroud)