Permalink
Browse files

It fundamentally hangs together under Grails 1.4.M1

  • Loading branch information...
1 parent 2f55ec9 commit 3e020c7bc7b9a5fc58d665558d8d16c67770bc23 Rob Fletcher committed May 31, 2011
View
@@ -1,17 +1,6 @@
#Grails Metadata file
-#Tue May 17 16:43:43 CEST 2011
-app.grails.version=1.3.7
+#Tue May 31 12:53:04 BST 2011
+app.grails.version=1.4.0.M1
app.name=scaffolding-example
app.servlet.version=2.4
app.version=20110517.01
-plugins.cache-headers=1.1.4
-plugins.cached-resources=1.0-alpha6
-plugins.cloud-foundry=1.0.0.M3
-plugins.fixtures=1.0.2
-plugins.geb=0.5.1
-plugins.hibernate=1.3.7
-plugins.jquery=1.6.1
-plugins.jquery-ui=1.8.10.1
-plugins.resources=1.0-RC2-SNAPSHOT
-plugins.spock=0.5-groovy-1.7
-plugins.tomcat=1.3.7
@@ -6,9 +6,9 @@ class BootStrap {
def fixtureLoader
def init = { servletContext ->
- if (GrailsUtil.environment != "test" && Book.count() == 0) {
- fixtureLoader.load("books")
- }
+// if (GrailsUtil.environment != "test" && Book.count() == 0) {
+// fixtureLoader.load("books")
+// }
}
def destroy = {
@@ -13,9 +13,22 @@ grails.project.dependency.resolution = {
mavenCentral()
}
dependencies {
- test "org.seleniumhq.selenium:selenium-firefox-driver:latest.integration"
- test("org.seleniumhq.selenium:selenium-htmlunit-driver:latest.integration") {
- exclude "xml-apis"
- }
+// test "org.seleniumhq.selenium:selenium-firefox-driver:latest.integration"
+// test("org.seleniumhq.selenium:selenium-htmlunit-driver:latest.integration") {
+// exclude "xml-apis"
+// }
}
+ plugins {
+ compile ":cache-headers:1.1.5"
+ compile ":cached-resources:1.0"
+// compile ":fixtures:1.0.7-SNAPSHOT"
+ compile ":hibernate:$grailsVersion"
+ compile ":jquery:1.6.1.1"
+ compile ":jquery-ui:1.8.10.1"
+ compile ":resources:1.0"
+ build ":cloud-foundry:1.0.0.M3"
+ build ":tomcat:$grailsVersion"
+// test ":spock:0.6-SNAPSHOT"
+ test ":geb:0.5.1"
+ }
}
@@ -54,14 +54,14 @@ grails.spring.bean.packages = []
// set per-environment serverURL stem for creating absolute links
environments {
production {
- grails.serverURL = "http://www.changeme.com"
+ grails.serverURL = "http://scaffolding.cloudfoundry.com"
}
development {
- grails.serverURL = "http://localhost:8080/${appName}"
+ grails.serverURL = "http://localhost:8080"
grails.resources.debug = true
}
test {
- grails.serverURL = "http://localhost:8080/${appName}"
+ grails.serverURL = "http://localhost:8080"
}
}
@@ -1,6 +1,6 @@
dataSource {
pooled = true
- driverClassName = "org.hsqldb.jdbcDriver"
+ driverClassName = "org.h2.Driver"
username = "sa"
password = ""
}
@@ -14,19 +14,19 @@ environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop','update'
- url = "jdbc:hsqldb:mem:devDB"
+ url = "jdbc:h2:mem:devDB"
}
}
test {
dataSource {
dbCreate = "update"
- url = "jdbc:hsqldb:mem:testDb"
+ url = "jdbc:h2:mem:testDb"
}
}
production {
dataSource {
dbCreate = "update"
- url = "jdbc:hsqldb:file:prodDb;shutdown=true"
+ url = "jdbc:h2:file:prodDb;shutdown=true"
}
}
}
@@ -64,15 +64,3 @@ class Thing {
static embedded = ["address"]
}
-
-class Address {
- String street
- String city
- String postCode
-
- static constraints = {
- street()
- city()
- postCode()
- }
-}
@@ -104,6 +104,8 @@
<p>The code for this application is hosted on <a href="https://github.com/robfletcher/grails-scaffolding">GitHub</a>.
Please feel free to fork, raise issues or contact me on <a href="http://twitter.com/rfletcherEW">Twitter</a>
with suggestions.</p>
+ <p>Grails core will contain HTML and CSS updates and scripted enhancements will be provided by an additional
+ plugin.</p>
<p>Below is a list of controllers that are currently deployed in this application,
click on each to execute its default action:</p>
@@ -0,0 +1,13 @@
+package scaffolding.example
+
+class Address {
+ String street
+ String city
+ String postCode
+
+ static constraints = {
+ street()
+ city()
+ postCode()
+ }
+}
@@ -1,100 +0,0 @@
-<%=packageName ? "package ${packageName}\n\n" : ''%>import grails.converters.JSON
-
-class ${className}Controller {
-
- static allowedMethods = [save: "POST", update: "POST", delete: "POST"]
-
- def index = {
- redirect(action: "list", params: params)
- }
-
- def list = {
- params.max = Math.min(params.max ? params.int('max') : 10, 100)
- [${propertyName}List: ${className}.list(params), ${propertyName}Total: ${className}.count()]
- }
-
- def create = {
- def ${propertyName} = new ${className}()
- ${propertyName}.properties = params
- return [${propertyName}: ${propertyName}]
- }
-
- def save = {
- def ${propertyName} = new ${className}(params)
- if (${propertyName}.save(flush: true)) {
- flash.message = message(code: 'default.created.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), ${propertyName}.id])
- redirect(action: "show", id: ${propertyName}.id)
- }
- else {
- render(view: "create", model: [${propertyName}: ${propertyName}])
- }
- }
-
- def show = {
- def ${propertyName} = ${className}.get(params.id)
- if (!${propertyName}) {
- flash.message = message(code: 'default.not.found.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), params.id])
- redirect(action: "list")
- }
- else {
- [${propertyName}: ${propertyName}]
- }
- }
-
- def edit = {
- def ${propertyName} = ${className}.get(params.id)
- if (!${propertyName}) {
- flash.message = message(code: 'default.not.found.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), params.id])
- redirect(action: "list")
- }
- else {
- return [${propertyName}: ${propertyName}]
- }
- }
-
- def update = {
- def ${propertyName} = ${className}.get(params.id)
- if (${propertyName}) {
- if (params.version) {
- def version = params.version.toLong()
- if (${propertyName}.version > version) {
- <% def lowerCaseName = grails.util.GrailsNameUtils.getPropertyName(className) %>
- ${propertyName}.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: '${domainClass.propertyName}.label', default: '${className}')] as Object[], "Another user has updated this ${className} while you were editing")
- render(view: "edit", model: [${propertyName}: ${propertyName}])
- return
- }
- }
- ${propertyName}.properties = params
- if (!${propertyName}.hasErrors() && ${propertyName}.save(flush: true)) {
- flash.message = message(code: 'default.updated.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), ${propertyName}.id])
- redirect(action: "show", id: ${propertyName}.id)
- }
- else {
- render(view: "edit", model: [${propertyName}: ${propertyName}])
- }
- }
- else {
- flash.message = message(code: 'default.not.found.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), params.id])
- redirect(action: "list")
- }
- }
-
- def delete = {
- def ${propertyName} = ${className}.get(params.id)
- if (${propertyName}) {
- try {
- ${propertyName}.delete(flush: true)
- flash.message = message(code: 'default.deleted.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), params.id])
- redirect(action: "list")
- }
- catch (org.springframework.dao.DataIntegrityViolationException e) {
- flash.message = message(code: 'default.not.deleted.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), params.id])
- redirect(action: "show", id: params.id)
- }
- }
- else {
- flash.message = message(code: 'default.not.found.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), params.id])
- redirect(action: "list")
- }
- }
-}
@@ -1,40 +0,0 @@
-<%=packageName%>
-<% import grails.persistence.Event %>
-<% import org.codehaus.groovy.grails.plugins.PluginManagerHolder %>
-<% excludedProps = Event.allEvents.toList() << 'version' << 'id' << 'dateCreated' << 'lastUpdated'
- persistentPropNames = domainClass.persistentProperties*.name
- props = domainClass.properties.findAll { persistentPropNames.contains(it.name) && !excludedProps.contains(it.name) }
- Collections.sort(props, comparator.constructors[0].newInstance([domainClass] as Object[]))
- for (p in props) {
- if (p.embedded) {
- def embeddedPropNames = p.component.persistentProperties*.name
- def embeddedProps = p.component.properties.findAll { embeddedPropNames.contains(it.name) && !excludedProps.contains(it.name) }
- Collections.sort(embeddedProps, comparator.constructors[0].newInstance([p.component] as Object[]))
- %><fieldset class="embedded"><legend><g:message code="${domainClass.propertyName}.${p.name}.label" default="${p.naturalName}" /></legend><%
- for (ep in p.component.properties) {
- renderFieldForProperty(ep, p.component, "${p.name}.")
- }
- %></fieldset><%
- } else {
- renderFieldForProperty(p, domainClass)
- }
- }
-
-private renderFieldForProperty(p, owningClass, prefix = "") {
- boolean hasHibernate = PluginManagerHolder.pluginManager.hasGrailsPlugin('hibernate')
- boolean display = true
- boolean required = false
- if (hasHibernate) {
- cp = owningClass.constrainedProperties[p.name]
- display = (cp ? cp.display : true)
- required = (cp ? !(cp.propertyType in [boolean, Boolean]) && !cp.nullable && (cp.propertyType != String || !cp.blank) : false)
- }
- if (display) { %>
-<div class="fieldcontain \${hasErrors(bean: ${propertyName}, field: '${prefix}${p.name}', 'error')} ${required ? 'required' : ''}">
- <label for="${prefix}${p.name}">
- <g:message code="${domainClass.propertyName}.${prefix}${p.name}.label" default="${p.naturalName}" />
- <% if (required) { %><span class="required-indicator">*</span><% } %>
- </label>
- ${renderEditor(p)}
-</div>
-<% } } %>
@@ -1,39 +0,0 @@
-<%=packageName%>
-<!doctype html>
-<html>
- <head>
- <meta name="layout" content="main">
- <g:set var="entityName" value="\${message(code: '${domainClass.propertyName}.label', default: '${className}')}" />
- <title><g:message code="default.create.label" args="[entityName]" /></title>
- </head>
- <body>
- <a href="#create-${domainClass.propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
- <div class="nav" role="navigation">
- <ul>
- <li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
- <li><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
- </ul>
- </div>
- <div id="create-${domainClass.propertyName}" class="content scaffold-create" role="main">
- <h1><g:message code="default.create.label" args="[entityName]" /></h1>
- <g:if test="\${flash.message}">
- <div class="message" role="status">\${flash.message}</div>
- </g:if>
- <g:hasErrors bean="\${${propertyName}}">
- <ul class="errors" role="alert">
- <g:eachError bean="\${${propertyName}}" var="error">
- <li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>><g:message error="\${error}"/></li>
- </g:eachError>
- </ul>
- </g:hasErrors>
- <g:form action="save" <%= multiPart ? ' enctype="multipart/form-data"' : '' %>>
- <fieldset class="form">
- <g:render template="form"/>
- </fieldset>
- <fieldset class="buttons">
- <g:submitButton name="create" class="save" value="\${message(code: 'default.button.create.label', default: 'Create')}" />
- </fieldset>
- </g:form>
- </div>
- </body>
-</html>
@@ -1,43 +0,0 @@
-<%=packageName%>
-<!doctype html>
-<html>
- <head>
- <meta name="layout" content="main">
- <g:set var="entityName" value="\${message(code: '${domainClass.propertyName}.label', default: '${className}')}" />
- <title><g:message code="default.edit.label" args="[entityName]" /></title>
- </head>
- <body>
- <a href="#edit-${domainClass.propertyName}" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
- <div class="nav" role="navigation">
- <ul>
- <li><a class="home" href="\${createLink(uri: '/')}"><g:message code="default.home.label"/></a></li>
- <li><g:link class="list" action="list"><g:message code="default.list.label" args="[entityName]" /></g:link></li>
- <li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>
- </ul>
- </div>
- <div id="edit-${domainClass.propertyName}" class="content scaffold-edit" role="main">
- <h1><g:message code="default.edit.label" args="[entityName]" /></h1>
- <g:if test="\${flash.message}">
- <div class="message" role="status">\${flash.message}</div>
- </g:if>
- <g:hasErrors bean="\${${propertyName}}">
- <ul class="errors" role="alert">
- <g:eachError bean="\${${propertyName}}" var="error">
- <li <g:if test="\${error in org.springframework.validation.FieldError}">data-field-id="\${error.field}"</g:if>><g:message error="\${error}"/></li>
- </g:eachError>
- </ul>
- </g:hasErrors>
- <g:form method="post" <%= multiPart ? ' enctype="multipart/form-data"' : '' %>>
- <g:hiddenField name="id" value="\${${propertyName}?.id}" />
- <g:hiddenField name="version" value="\${${propertyName}?.version}" />
- <fieldset class="form">
- <g:render template="form"/>
- </fieldset>
- <fieldset class="buttons">
- <g:actionSubmit class="save" action="update" value="\${message(code: 'default.button.update.label', default: 'Update')}" />
- <g:actionSubmit class="delete" action="delete" value="\${message(code: 'default.button.delete.label', default: 'Delete')}" formnovalidate="" data-confirmation-message="\${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}" />
- </fieldset>
- </g:form>
- </div>
- </body>
-</html>
Oops, something went wrong.

0 comments on commit 3e020c7

Please sign in to comment.