Skin Loader

  • Tags: /
  • Latest: 1.0.9
  • Last Updated: 04 September 2011
  • Grails version: 2.0.0.M1
  • Authors: Anthony Campbell
3 votes
Dependency:
compile ":skin-loader:1.0.9"

 Documentation  Source

Summary

A simple plug-in which provides the ability to load "skin" into your application or plug-in.

Installation

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:

grails load-skin

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
  • Create a Book class.
grails create-domain-class Book
  • Add a name property to the Book
class Book {
    String name
}
  • Now generate your controller and views.
grails generate-all Book
  • Run your app, and check out the various views.
grails run-app
  • Enjoy!

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.

Description

Overview

A simple plug-in which provides the ability to load "skins" into your application or plug-in.

The plug-in is designed to speed up the process further when developing grails applications. It will install templates, layout, images, CSS, JavaScript, i18n, configuration, Groovy / Java sources, utilities, services, and tag libraries into the relevant folders from an existing skin folder. Particularly useful for developers who use Grails frequently and find themselves performing these steps manually.

Grails Skin Loader by default also comes with the "remote-forms" skin. This will scaffold Ajax based forms which will provide real time validation when the form is used.

Unlike ScaffoldTags this plug-in only provides the ability to pre-install the range of resources it supports. It does not attempt to provide the additional ScaffoldTags which allow the views to auto update upon domain class change. This helps reduce the plug-in's complexity, management, and hopefully increase the plug-in's uptake.

If you find any issues, please submit a bug on JIRA: http://jira.codehaus.org/browse/GRAILSPLUGINS

Please look at the CHANGES file to see what has changed since the last official release.