Installation
To install the Grails Skin Loader plug-in type in this command in your project's root folder:
grails install-plugin skin-loader
If you're modifying an existing application, backup any scaffolding templates you've already established now; you can use them later but you'll want to see how it looks first.
Usage
Grails Skin Loader comes with basic scaffolding views that replace the core grails scaffolding view templates. To install these, run the following command:
If you already have your own scaffold templates in src/templates, I suggest you make backups before running this command. It will warn you before erasing/overwriting anything, though. Once executed it will prompt you to select a skin. After selecting a skin from the available list, the command will continue and complete the installation. After doing that, you can generate your views as you normally would (or use Grails scaffolding as you normally would).
Available skins
Currently the following skins are provided:
- remote-forms - makes use of prototype and script.aculo.us and the existing remote form tags provided by Grails. Allows the forms generated through scaffolding to be Ajax driven.
Changing skins
You can change the view skins currently used by the application, simply invoke the same
load-skin command along with the new skin name:
grails load-skin <skinname>
If you don't specify a skin, it will look at all the skins available in the skins directory of the plug-in.
Creating a skin
When creating a skin, I recommend providing enough templates such that it can stand alone. You may want to package up your rendering templates into a skin that you can reuse across applications; currently these can then be used by other applications by placing them in the skins directory of the plug-in after installing the plug-in.
Removing a skin
If you don't have a need for a given skin, you can blow it away from the skins directory.
Quick-start walk through
The following assumes you're using Grails 1.2.0+.
- Create an application and install skin-loader.
grails create-app sample
cd sample
grails install-plugin skin-loader
grails load-skin remote-forms
grails create-domain-class Book
- Add a name property to the Book
class Book {
String name
}
- Now generate your controller and views.
- Run your app, and check out the various views.
Upgrading from an earlier release
There shouldn't be any issues upgrading from an earlier release. You'll need to blow away the older skin-loader plugin directory, as usual.
Tips
- Sometimes you might find it necessary to run a grails clean in order to eliminate a view you created that has been copied to the WEB-INF directory but which no longer exists in your views / scaffold.
- Sometimes you might find it necessary to clean up the plug-in installation if the scaffolding you used before leaves some files behind. This will be improved upon in a future release.