在Rails应用程序中,常见的是伴随有Destroy操作并带有警告-“您确定要删除此操作吗?” 典型的代码如下所示:
link_to("Destroy", "http://www.example.com", :method => :delete, :confirm => "Are you sure?")
ActiveAdmin中是否有一种方法可以仅针对一个模型(而非全局模型)自定义确认字符串?我看到字符串是从active_admin.delete_confirmation
翻译键加载的。字符串可以是特定于模型的吗?
我认为您无法通过配置更改字符串。但是,您可以更改默认操作:
索引表:https : //github.com/activeadmin/active_admin/blob/master/docs/3-index-pages/index-as-table.md
index do
column :title
actions defaults: false do |post|
link_to("Destroy", "http://www.example.com", :method => :delete, :confirm => "Are you sure?")
end
end
显示页面:https : //github.com/activeadmin/active_admin/blob/master/docs/8-custom-actions.md#action-items
action_item only: :show do
link_to("Destroy", "http://www.example.com", :method => :delete, :confirm => "Are you sure?")
end
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句