使用 ActiveAdmin 进行多步骤表单?
是否可以使用 ActiveAdmin 创建多步骤表单?
如果没有,是否可以在提交表单后添加另一个重定向到的页面(不是默认索引、显示或表单页面)?
Is it possible to create a multistep form with ActiveAdmin?
If not, is it possible to just add another page that it redirects to after submitting the form (one that is not the default index, show or form pages)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我自己也一直在苦恼这个问题。我发现您可以使用 ActiveAdmin 文件中的集合操作添加自己的页面。假设您的模型名为 MyModel,您可以将其添加到 ActiveAdmin my_model.rb 文件中。
然后,您需要在 /app/views/admin/page1.html.erb 和 page2.html.erb 创建一个视图
I've been fretting with this issue myself. I found that you can add your own pages using collection actions in your ActiveAdmin file. Say your model is called MyModel, you would add this to your ActiveAdmin my_model.rb file.
You would then need to create a view at /app/views/admin/page1.html.erb and page2.html.erb
如果您正在处理模型的单个实例,您可能需要成员操作
表单需要对单个资源进行操作
http://activeadmin.info /docs/8-custom-actions.html#member_actions
you'll probably want a member action if youre working on a single instance of a model
a form would need an action which operates on a single resource
http://activeadmin.info/docs/8-custom-actions.html#member_actions
我还没有在 active_admin 中执行此操作,但我会查看多步表单上的railscast< /a> 并将其与 active_admin 的 集合操作。本质上,保持模型重,但有一个自定义操作来处理表单内模型的验证、进展和创建。
I haven't had to do it within active_admin yet, but I would check out the railscast on multistep forms and combine it with active_admin's collection actions. Essentially, keep it model heavy but have a single custom action that handles the validation, progression, and creation of the model within the form.