nerdErg

GoodForm Compatibility

GoodForm 2.0.0 has been tested with Grails 2.2.4, 2.3.7 and 2.4.3.

This documents what you may need to adjust to get GoodForm to work with older versions than 2.4.3. This document uses the Tutorial for reference.

1. Using the resources plugin

GoodForm 2.0 will work with both the asset-pipeline and th resources plugin. The main difference is how you set up your layout file. If you’re following the Tutorial, in the configuration section you don’t need to change the application.js or application.css you just need to set up you grails-app/views/layouts/main.gsp like this:

<!DOCTYPE html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"><!--<![endif]-->
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <title><g:layoutTitle default="Grails"/></title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon">
  <link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
  <link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}">

  <r:require module="goodForm"/>
  <r:require module="application"/>
  <r:layoutResources/>

  %{-- include bootstrap from the CDN --}%
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css">
  <r:external uri="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"/>

  %{-- include font-awesome --}%
  <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">

  <g:layoutHead/>
  <r:layoutResources/>
</head>

<body>
<div id="grailsLogo" role="banner"><a href="http://grails.org"><img
    src="${resource(dir: 'images', file: 'grails_logo.png')}" alt="Grails"/></a></div>

<div class="container">
  <g:layoutBody/>
</div>

<div class="footer" role="contentinfo"></div>

<div id="spinner" class="spinner" style="display:none;"><g:message code="spinner.alt" default="Loading&hellip;"/></div>
<g:javascript library="application"/>
<r:layoutResources/>
</body>
</html>

The order of adding resources is important as the CDN included resources need the resources in the goodform module.

Where we suggest adding `debug grails.app to the logging config in the Tutorial you may want to limit the scope of debug as the resources plugin debugging will overwhelm you :-)

2. Grails 2.2.4

GoodForm 2.0.0 uses the rest-client-builder plugin version 2.0.3 by default. This drags in the latest version of Spring which is not compatible with Grails 2.2.4 so you need to exclude this when adding GoodForm and manually add rest-client-builder 1.0.3. You probably want to remove the jquery plugin and use the later version from GoodForm. Your build config should look something like this:

...
    plugins {
        runtime ":hibernate:$grailsVersion"
//        runtime ":jquery:1.8.3"
        runtime ":resources:1.2"

        build ":tomcat:$grailsVersion"

        runtime ":database-migration:1.3.2"

        compile ':cache:1.0.1'

        compile ':rest-client-builder:1.0.3'
        compile ('com.nerderg.grails.plugins:goodform:2.0.0-SNAPSHOT') {
            excludes "rest-client-builder"
        }
        compile ":simple-suggestions:0.2"
    }