在 Grails 中创建管理部分的最佳方式 [英] Best way to create an Admin section in Grails

查看:10
本文介绍了在 Grails 中创建管理部分的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道在 Grails 应用程序中创建管理(后端)部分的最佳方法是什么?

I'm wondering what's the best way to create an Admin (backend) section in a Grails app ?

我想在 Grails 的controllers"文件夹中创建一个Admin"文件夹来放置我所有的管理控制器.但是,我是否必须为每个管理控制器手动创建 URL 映射?

I want to create an "Admin" folder in the "controllers" folder of Grails to put all my admin controllers. But then will I have to create manually the URL mapping for each Admin controller?

我已经使用 genernate-all 命令生成了我所有的前端 GSP,该命令需要一个 域类,但是我知道如何为我的管理部分生成我的 CRUD(使用相同的域类).我搞砸了吗?

I have already generated all my frontend GSP with the genernate-all command which takes a Domain Class but know how can I generate my CRUD for my admin section (with the same domain class). Am I screwed ?

非常感谢您的提示!

推荐答案

我的偏好是为管理员提供一个单独的应用程序.将您所有的域类放在一个插件中,并将该插件安装到管理应用程序和消费者应用程序中.

My preference for this is to have a separate application for admin. Stick all of your domain classes in a plugin and install that plugin into both the admin application and the consumer appilcation.

这样,您就可以根据自己的喜好调整控制器,而不必担心最终用户会碰到它们.共享服务也可以在域插件中.

That way, you can tweak the controllers to your hearts content and not worry about end users hitting them. Shared services can also be in the domain plugin.

有一个特殊的文件,您可以将它放在名为 BuildConfig.groovy 的 grails-app/conf 中,您可以在其中指定本地"插件,例如自动带入类路径的域插件,而无需打包/安装插件.让它变得超级简单.

There's a special file that you can put in your grails-app/conf called BuildConfig.groovy where you can specify "local" plugins like the domain plugin that are automatically brought into the classpath without having to package/install the plugin. Makes it super easy.

这篇关于在 Grails 中创建管理部分的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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