-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grails Detailed Scaffolding #26
Comments
If #22 were fixed, you could customize the templates to generate the exact same code that the older versions of scaffolding generated. |
Oh my God! When I first wrote the description of the issue, the code was not visible because I did not put it between quote tags. Now I fixed and the code is there. @jeffbrown Can you please have a look again at my bug description after I corrected its description and confirm to me this will be solved by #22 Thanks |
The new version of scaffolding is built on the fields plugin, which provides complete control of customising the output. See https://grails-fields-plugin.github.io/grails-fields/guide/customizingFieldRendering.html |
Oh my God!! That that explained many things .... So in this case, the gap would mostly contain just instances of the field tag instead of the infamous f:all ... That seems convenient ... Since the field already has a wrapper and a widget. And as I understood from the documentation, I can write any wrappers and widgets and use them for any field I want. |
@graemerocher
How much support is there in Grails ? |
You can customize the templates to generate pretty much anything you like, including the example you described there. |
I just tried to create an application with grails. Just doing nothing, just create a new grails app, and here is what I got :
|
probably a JVM bug, make sure your JVM is the most recent version |
So, I updated to the latest Grails version. 2- @jeffbrown
I want to change the template to generate the actual field <f:field depending on the fields of the domain class. So this is a code generation thing. |
Both of those questions call for a discussion and neither are directly related to the issue here. Better forums for those questions are our community Slack channel at http://grails.slack.com and our mailing list at https://groups.google.com/forum/#!forum/grails-dev-discuss. |
@jeffbrown @graemerocher Any code samples ? Documentations ? Again I am asking about code generation from within the script. Template create only copies the template files and replaces some place holders with actual bean names :(. You mentioned before that templates is the way to do it, but that's not the case .... |
Yes, I think it is. The dynamic templates appear to work. It may be that the information you need isn't being made available in the model. |
Ok.
I thought there could be easier way in Grails or code to reuse since ancient versions of Grails used to do that. |
The issue is that I don't think you have access to the relevant |
I can see the source code of the class and related methods, so why not copying the source and change it to support these changes ... |
You have the same conversation happening in 3 separate places right now including here, the mailing list and Slack. I propose that you carry on the conversation on the mailing list. |
@jeffbrown |
Hi, As it is already mentioned in previous comments (as well as on few different conversations around) it should be possible to owerride default generate-* scripts in order to provide additional data to template (in this case a list of domain properties). However, I can't find any examples or tutorials how to do it so I'm interested is there any docs/example hoe to do it? Or, at least, a hint how to start? Thx in advance |
@zbubric That isn't possible. You would have to create a custom command http://docs.grails.org/latest/guide/commandLine.html#creatingCustomCommands There is also a generic scaffolding library available for use https://github.com/grails/scaffolding See https://github.com/grails-plugins/grails-angularjs-scaffolding for an example of it being used |
@jameskleeh Thx! In matter of fact, I didn't notice that this is not generic scaffolding library that you mentioned in the post :-) |
In Grails 3.x or even before, the generated gsp-s contain very concise code.
All of the form fields and input are dynamically generated by a tag
"<f:all bean="your_domain_object"/>
However, I remember, in earlier versions of Grails, the generated gsps would allow more control and more verbose. What I mean, is that, there is no call to
"<f:all bean="your_domain_object"/>
and each control is rendered on the generated gsp file.For example
<gsp:input property="#{user.name}" />
... etcIs this feature still supported by the latest Grails version ? Can it be brought back as it enables much more flexibility.
The text was updated successfully, but these errors were encountered: