Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find the default templates for all the Grails fields plugin types?

I was hopping to have an easy way to customize the display behavior of the Grails fields plugin after reading its docs, but I just realized that it demands an enormous effort as there is no available templates to start from.

I can see the display functionality is hard-coded in FormFieldsTagLib (from methods like renderDefaultInput() ) but I think it is imperative to have the templates themselves (or a way to generate them, somewhat like generating static scaffolding in Grails).

I can see no consistent (and reasonable) way to customize display behaviors for the Grails fields plugin without that. Am I missing something?

Imagine the use case where someone wants to change the boolean default rendering just to display the field label after (and not before) the checkbox, and keep it available to all the boolean fields within its application. Which concerns will he need to handle regarding if the field is required, has errors, prefix and so on? When all he needed was just moving two divs around.

Grails version: 2.5.4, fields-plugin version: 1.5.1

like image 816
Cléssio Mendes Avatar asked Mar 01 '17 23:03

Cléssio Mendes


2 Answers

You aren't missing something. You'd have to re-create the existing implementation of each field type rendering in a template for use with the plugin. There isn't a way to generate a file to start with (like scaffolding).

I won't bore you with the historical reason as to why this is the case, but if you do create a set of base templates it would be a good idea to contribute back to the plugin.

like image 136
Joshua Moore Avatar answered Oct 23 '22 09:10

Joshua Moore


I had an issue with the <f:table> tag, and found this post, which led me to find the base or default template inside the plugin repo. Take a look at

https://github.com/grails3-plugins/fields/tree/master/grails-app/views

That may help you finding some default templates, along with the official doc and this answer on where to put the override.

Hope it helps you.

like image 32
Eugenius Avatar answered Oct 23 '22 08:10

Eugenius