在活动管理 Rails 4 中的显示页面上更改删除操作的确认消息 [英] Change confirmation message on delete action on show page in active admin rails 4

查看:37
本文介绍了在活动管理 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

结束

这在索引页上运行良好.我也想更改显示页面上删除操作的默认确认消息.它仍然显示默认消息,例如您确定要删除它吗?"

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?'

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

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

有人知道这个吗?谢谢.

Anyone know about this? Thanks.

推荐答案

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

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

这篇关于在活动管理 Rails 4 中的显示页面上更改删除操作的确认消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆