Skip to content
This repository was archived by the owner on Oct 31, 2018. It is now read-only.

Upgraded to grails 2.4.3 #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions KickstartWithBootstrapGrailsPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import kickstart.CustomDateEditorRegistrar
class KickstartWithBootstrapGrailsPlugin {

def title = "Kickstart with Bootstrap - Good looking websites!"
def version = "1.1.0"
def version = "1.2.0"
def license = "APACHE"
def description = """\
Kickstart is a plugin for Grails to start your project with a good looking frontend. \
Expand All @@ -16,7 +16,7 @@ frontend framework initiated by Twitter."""
]

def developers = [
[ name: "J�rg Rech", email: "[email protected]" ]
[ name: "Jörg Rech", email: "[email protected]" ]
]
def documentation = "http://grails.org/plugin/kickstart-with-bootstrap"
def scm = [ url: "https://github.com/joergrech/KickstartWithBootstrap" ]
Expand Down
2 changes: 1 addition & 1 deletion application.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Grails Metadata file
#Sat Jan 25 08:08:58 CET 2014
app.grails.version=2.3.5
app.grails.version=2.4.3
#app.name=kickstart
app.name=kickstartWithBootstrap
4 changes: 2 additions & 2 deletions grails-app/conf/BuildConfig.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ grails.project.dependency.resolution = {
":rest-client-builder:1.0.3") {
export = false
}
compile ":scaffolding:2.0.1" // Needed since Grails 2.3
compile ":scaffolding:2.1.1" // Needed since Grails 2.3

runtime ":resources:1.2.1" // Needed for Bootstrap's less files
runtime ":resources:1.2.9" // Needed for Bootstrap's less files
compile ":lesscss-resources:1.3.3" // Needed for Bootstrap's less files
}
}
9 changes: 2 additions & 7 deletions src/templates/artifacts/Controller.groovy
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
@artifact.package@/**
* @artifact.name@
* A controller class handles incoming web requests and performs actions such as redirects, rendering views and so on.
*/
class @artifact.name@ {
@artifact.package@class @artifact.name@ {

static scaffold = true
// def index = { }
def index() { }
}
32 changes: 2 additions & 30 deletions src/templates/artifacts/DomainClass.groovy
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
@artifact.package@/**
* @artifact.name@
* A domain class describes the data object and it's mapping to the database
*/
class @artifact.name@ {
@artifact.package@class @artifact.name@ {

/* Default (injected) attributes of GORM */
// Long id
// Long version

/* Automatic timestamping of GORM */
// Date dateCreated
// Date lastUpdated

// static belongsTo = [] // tells GORM to cascade commands: e.g., delete this object if the "parent" is deleted.
// static hasOne = [] // tells GORM to associate another domain object as an owner in a 1-1 mapping
// static hasMany = [] // tells GORM to associate other domain objects for a 1-n or n-m mapping
// static mappedBy = [] // specifies which property should be used in a mapping

static mapping = {
static constraints = {
}

static constraints = {
}

/*
* Methods of the Domain Class
*/
// @Override // Override toString for a nicer / more descriptive UI
// public String toString() {
// return "${name}";
// }
}
6 changes: 1 addition & 5 deletions src/templates/artifacts/Filters.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@artifact.package@/**
* @artifact.name@
* A filters class is used to execute code before and after a controller action is executed and also after a view is rendered
*/
class @artifact.name@ {
@artifact.package@class @artifact.name@ {

def filters = {
all(controller:'*', action:'*') {
Expand Down
3 changes: 3 additions & 0 deletions src/templates/artifacts/ScaffoldingController.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@artifact.package@class @artifact.name@ {
static scaffold = true
}
6 changes: 2 additions & 4 deletions src/templates/artifacts/Service.groovy
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@artifact.package@/**
* @artifact.name@
* A service class encapsulates the core business logic of a Grails application
*/
@artifact.package@import grails.transaction.Transactional

@Transactional
class @artifact.name@ {

Expand Down
10 changes: 3 additions & 7 deletions src/templates/artifacts/TagLib.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@artifact.package@/**
* @artifact.name@
* A taglib library provides a set of reusable tags to help rendering the views.
*/
class @artifact.name@ {
static defaultEncodeAs = 'html'
//static encodeAsForTags = [tagName: 'raw']
@artifact.package@class @artifact.name@ {
static defaultEncodeAs = [taglib:'html']
//static encodeAsForTags = [tagName: [taglib:'html'], otherTagName: [taglib:'none']]
}
6 changes: 1 addition & 5 deletions src/templates/artifacts/Tests.groovy
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
@artifact.package@/**
* @artifact.name@
* A unit test class is used to test individual methods or blocks of code without considering the surrounding infrastructure
*/
@import grails.test.*
@artifact.package@import grails.test.*

class @artifact.name@ extends @artifact.superclass@ {
protected void setUp() {
Expand Down
16 changes: 8 additions & 8 deletions src/templates/scaffolding/AsyncController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ${className}Controller {
}
}

def show(Long id) {
def show(String id) {
${className}.async.get(id).then { ${propertyName} ->
respond ${propertyName}
}
Expand All @@ -41,7 +41,7 @@ class ${className}Controller {

${propertyName}.save flush:true
request.withFormat {
form {
form multipartForm {
flash.message = message(code: 'default.created.message', args: [message(code: '${propertyName}.label', default: '${className}'), ${propertyName}.id])
redirect ${propertyName}
}
Expand All @@ -50,13 +50,13 @@ class ${className}Controller {
}
}

def edit(Long id) {
def edit(String id) {
${className}.async.get(id).then { ${propertyName} ->
respond ${propertyName}
}
}

def update(Long id) {
def update(String id) {
${className}.async.withTransaction {
def ${propertyName} = ${className}.get(id)
if (${propertyName} == null) {
Expand All @@ -71,7 +71,7 @@ class ${className}Controller {
}

request.withFormat {
form {
form multipartForm {
flash.message = message(code: 'default.updated.message', args: [message(code: '${className}.label', default: '${className}'), ${propertyName}.id])
redirect ${propertyName}
}
Expand All @@ -80,7 +80,7 @@ class ${className}Controller {
}
}

def delete(Long id) {
def delete(String id) {
${className}.async.withTransaction {
def ${propertyName} = ${className}.get(id)
if (${propertyName} == null) {
Expand All @@ -91,7 +91,7 @@ class ${className}Controller {
${propertyName}.delete flush:true

request.withFormat {
form {
form multipartForm {
flash.message = message(code: 'default.deleted.message', args: [message(code: '${className}.label', default: '${className}'), ${propertyName}.id])
redirect action:"index", method:"GET"
}
Expand All @@ -102,7 +102,7 @@ class ${className}Controller {

protected void notFound() {
request.withFormat {
form {
form multipartForm {
flash.message = message(code: 'default.not.found.message', args: [message(code: '${propertyName}.label', default: '${className}'), params.id])
redirect action: "index", method: "GET"
}
Expand Down
24 changes: 8 additions & 16 deletions src/templates/scaffolding/Controller.groovy
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
<%=packageName ? "package ${packageName}\n\n" : ''%>

import static org.springframework.http.HttpStatus.*
import grails.transaction.Transactional

/**
* ${className}Controller
* A controller class handles incoming web requests and performs actions such as redirects, rendering views and so on.
*/
@Transactional(readOnly = true)
class ${className}Controller {

static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]

def index(Integer max) {
params.max = Math.min(max ?: 10, 100)
respond ${className}.list(params), model:[${propertyName}Count: ${className}.count()]
}

def list(Integer max) {
def index(Integer max) {
params.max = Math.min(max ?: 10, 100)
respond ${className}.list(params), model:[${propertyName}Count: ${className}.count()]
}
Expand Down Expand Up @@ -44,8 +36,8 @@ class ${className}Controller {
${propertyName}.save flush:true

request.withFormat {
form {
flash.message = message(code: 'default.created.message', args: [message(code: '${propertyName}.label', default: '${className}'), ${propertyName}.id])
form multipartForm {
flash.message = message(code: 'default.created.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), ${propertyName}.id])
redirect ${propertyName}
}
'*' { respond ${propertyName}, [status: CREATED] }
Expand All @@ -71,7 +63,7 @@ class ${className}Controller {
${propertyName}.save flush:true

request.withFormat {
form {
form multipartForm {
flash.message = message(code: 'default.updated.message', args: [message(code: '${className}.label', default: '${className}'), ${propertyName}.id])
redirect ${propertyName}
}
Expand All @@ -90,7 +82,7 @@ class ${className}Controller {
${propertyName}.delete flush:true

request.withFormat {
form {
form multipartForm {
flash.message = message(code: 'default.deleted.message', args: [message(code: '${className}.label', default: '${className}'), ${propertyName}.id])
redirect action:"index", method:"GET"
}
Expand All @@ -100,8 +92,8 @@ class ${className}Controller {

protected void notFound() {
request.withFormat {
form {
flash.message = message(code: 'default.not.found.message', args: [message(code: '${propertyName}.label', default: '${className}'), params.id])
form multipartForm {
flash.message = message(code: 'default.not.found.message', args: [message(code: '${domainClass.propertyName}.label', default: '${className}'), params.id])
redirect action: "index", method: "GET"
}
'*'{ render status: NOT_FOUND }
Expand Down
62 changes: 62 additions & 0 deletions src/templates/scaffolding/RestfulController.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<%=packageName ? "package ${packageName}\n\n" : ''%>

import static org.springframework.http.HttpStatus.*
import grails.transaction.Transactional

@Transactional(readOnly = true)
class ${className}Controller {

static responseFormats = ['json', 'xml']
static allowedMethods = [save: "POST", update: "PUT", delete: "DELETE"]

def index(Integer max) {
params.max = Math.min(max ?: 10, 100)
respond ${className}.list(params), [status: OK]
}

@Transactional
def save(${className} ${propertyName}) {
if (${propertyName} == null) {
render status: NOT_FOUND
return
}

${propertyName}.validate()
if (${propertyName}.hasErrors()) {
render status: NOT_ACCEPTABLE
return
}

${propertyName}.save flush:true
respond ${propertyName}, [status: CREATED]
}

@Transactional
def update(${className} ${propertyName}) {
if (${propertyName} == null) {
render status: NOT_FOUND
return
}

${propertyName}.validate()
if (${propertyName}.hasErrors()) {
render status: NOT_ACCEPTABLE
return
}

${propertyName}.save flush:true
respond ${propertyName}, [status: OK]
}

@Transactional
def delete(${className} ${propertyName}) {

if (${propertyName} == null) {
render status: NOT_FOUND
return
}

${propertyName}.delete flush:true
render status: NO_CONTENT
}
}
Loading