Vâng, đó là có thể.
Actions Đặt tên như "Add User" => "Tạo tài khoản", "Chỉnh sửa tài khoản" => "Cập nhật tài" vv
Thay vì phải f.actions
, bạn có thể có
<%= f.actions do %>
<%= f.action :submit, as: :button, label: 'Create User' %>
<%= f.action :cancel, as: :link %> # change it to button if needed
<% end %>
ActiveAdmin sử dụng formtastic, read more here.
Success nhắn On Xóa, Tạo và chỉnh sửa như "sử dụng thành công tạo" => "khách hàng tạo thành công"
def create # or any other action
super do |format| # this is important - override the original implementation
redirect_to(
admin_users_path,
notice: 'Your custom message for successful user creation'
) and return
end
end
Bạn cũng có thể thử điều này:
def create # or any other action
super do |format| # this is important - override the original implementation
flash[:notice] = 'Your custom message for successful user creation'
# you do understand, that if you have different routes you should change this, right?
redirect_to admin_users_path
end
end
Thêm nút tạo trên trang hiển thị bên cạnh chỉnh sửa và xóa
action_item only: :show do
link_to 'Create new user', new_admin_users_path
end
Nguồn
2015-11-26 19:33:45
1 và 2 không làm việc .. .... Đầu tiên, Hủy hiển thị dưới dạng liên kết Thứ hai, Không có gì xảy ra – Mukesh
Tôi đã chỉnh sửa câu trả lời, đọc tài liệu 1 như tôi đã đề xuất và [cho bạn liên kết] (https://github.com/justinfrench/formtastiC# the-story). 2 nó sẽ làm việc, bạn đã xác định nó bên trong 'điều khiển làm kết thúc' khối? –
Cảm ơn rất nhiều Dude ... Bây giờ tất cả làm việc ...... :) – Mukesh