diff --git a/scaffoldtags/CHANGES.txt b/scaffoldtags/CHANGES.txt index 996b8b5..fbf7f67 100644 --- a/scaffoldtags/CHANGES.txt +++ b/scaffoldtags/CHANGES.txt @@ -1,4 +1,9 @@ -VERSION: 0.7.3 +VERSION: 0.7.4 + +Changes since 0.7.3: +- Fixed the install-skin to be compatible with higer grails versions script. +- load scaffold files not only for the war compiled environment. +- fix template CRUD files to support domain classes in packages. Changes since 0.7.2: - Fixed the install-skin script. Thanks to J. Barmash for notifying me. diff --git a/scaffoldtags/ScaffoldTagsGrailsPlugin.groovy b/scaffoldtags/ScaffoldTagsGrailsPlugin.groovy index d46372e..59acd14 100644 --- a/scaffoldtags/ScaffoldTagsGrailsPlugin.groovy +++ b/scaffoldtags/ScaffoldTagsGrailsPlugin.groovy @@ -25,7 +25,7 @@ * @since March 25, 2007 */ class ScaffoldTagsGrailsPlugin { - def version = "0.7.3" + def version = "0.7.4" def dependsOn = [:] def author="Daiji Takamori" def authorEmail="dt_02138@yahoo.com" diff --git a/scaffoldtags/build.xml b/scaffoldtags/build.xml index e74894a..1ec7321 100644 --- a/scaffoldtags/build.xml +++ b/scaffoldtags/build.xml @@ -4,7 +4,7 @@ - + diff --git a/scaffoldtags/docs/index.html b/scaffoldtags/docs/index.html index 552598e..9f689ad 100644 --- a/scaffoldtags/docs/index.html +++ b/scaffoldtags/docs/index.html @@ -13,7 +13,7 @@

[grails plugin] Grails ScaffoldT Grails. Please let me know what you think of it. Thanks!    — Daiji

-Current Version: 0.7.3 +Current Version: 0.7.4

Links

    diff --git a/scaffoldtags/grails-app/taglib/ScaffoldTagLib.groovy b/scaffoldtags/grails-app/taglib/ScaffoldTagLib.groovy index 544e8f9..1571648 100644 --- a/scaffoldtags/grails-app/taglib/ScaffoldTagLib.groovy +++ b/scaffoldtags/grails-app/taglib/ScaffoldTagLib.groovy @@ -26,11 +26,12 @@ import org.codehaus.groovy.grails.commons.GrailsClass * @since 08-Mar-2007 */ class ScaffoldTagLib { - private static final VERSION = "0.7.3" - private static final Log LOG = LogFactory.getLog(ScaffoldTagLib.class) - private static final String PATH_TO_VIEWS = "/WEB-INF/grails-app/views"; - private static final String PLUGIN_PATH_TO_VIEWS = "/WEB-INF/plugins/scaffold-tags-${VERSION}/grails-app/views"; - + private static final VERSION = "0.7.4" + private static final Log LOG = LogFactory.getLog(ScaffoldTagLib.class) + private static String PATH_TO_VIEWS = "/WEB-INF/grails-app/views"; + private static String PLUGIN_PATH_TO_VIEWS = "/WEB-INF/plugins/scaffold-tags-${VERSION}/grails-app/views"; + private static boolean initPaths = false + /** Primitive class translation map */ private static final classTranslations = [(Boolean.TYPE): Boolean.class, (Character.TYPE): Character.class, @@ -711,15 +712,31 @@ class ScaffoldTagLib { * /scaffolding/{view} * {pluginPath}/scaffolding/{view} */ - private findView(view) { - // There needs to be a better way to do the path lookup - String controllerUri = grailsAttributes.getControllerUri(request) - def viewpaths = ["${PATH_TO_VIEWS}${controllerUri}", - "${PATH_TO_VIEWS}/scaffolding", - "${PLUGIN_PATH_TO_VIEWS}/scaffolding"] - // println "searching for ${view} in ${viewpaths}" - def ctx = grailsAttributes.applicationContext - def resourceLoader = ctx.containsBean('groovyPageResourceLoader') ? ctx.groovyPageResourceLoader : ctx + private findView(view) { + // There needs to be a better way to do the path lookup + String controllerUri = grailsAttributes.getControllerUri(request) + + def ctx = grailsAttributes.applicationContext + def resourceLoader = ctx.containsBean('groovyPageResourceLoader') ? ctx.groovyPageResourceLoader : ctx + + if (!initPaths) { + if (!resourceLoader.getResource("${PATH_TO_VIEWS}/error.gsp").exists()) + { + PATH_TO_VIEWS = PATH_TO_VIEWS.substring( + PATH_TO_VIEWS.indexOf('/', 1) + 1) + PLUGIN_PATH_TO_VIEWS = PLUGIN_PATH_TO_VIEWS.substring( + PLUGIN_PATH_TO_VIEWS.indexOf('/', 1) + 1) + if (!resourceLoader.getResource("${PLUGIN_PATH_TO_VIEWS}/scaffolding/editor/domain.gsp").exists()) { + PLUGIN_PATH_TO_VIEWS = org.codehaus.groovy.grails.plugins.GrailsPluginUtils.pluginInfos.find { it.name == "scaffold-tags" }?.pluginDir.toString() + "/grails-app/views" + PLUGIN_PATH_TO_VIEWS = "file:" + PLUGIN_PATH_TO_VIEWS.replace("/./", "/") + } + } + initPaths = true + } + def viewpaths = ["${PATH_TO_VIEWS}${controllerUri}", + "${PATH_TO_VIEWS}/scaffolding", + "${PLUGIN_PATH_TO_VIEWS}/scaffolding"] + for (p in viewpaths) { if (view instanceof String || view instanceof GString) { def uri = "${p}/${view}" diff --git a/scaffoldtags/plugin.xml b/scaffoldtags/plugin.xml index 988cf72..e9950ee 100644 --- a/scaffoldtags/plugin.xml +++ b/scaffoldtags/plugin.xml @@ -1,4 +1,4 @@ - + Daiji Takamori dt_02138@yahoo.com Adds tags to support fully-customizable & dynamic scaffolding diff --git a/scaffoldtags/scripts/InstallSkin.groovy b/scaffoldtags/scripts/InstallSkin.groovy index bc3c512..8703d18 100644 --- a/scaffoldtags/scripts/InstallSkin.groovy +++ b/scaffoldtags/scripts/InstallSkin.groovy @@ -23,16 +23,16 @@ */ grailsHome = Ant.antProject.properties."environment.GRAILS_HOME" -includeTargets << new File ( "${grailsHome}/scripts/Init.groovy" ) +includeTargets << grailsScript("_GrailsInit") -target ('default': "Installs a ScaffoldTags skin") { - version = "0.7.3" - pluginHome = "${pluginsHome}/scaffold-tags-${version}" - pluginSkins = "${pluginHome}/src/skins" - appSkins = "${basedir}/src/skins" - +target ('default': "Installs a ScaffoldTags skin") { + depends(checkVersion, parseArguments) + + pluginSkins = "${scaffoldTagsPluginDir}/src/skins" + appSkins = "${basedir}/src/skins" + // Obtain the skin name; make sure it exists - skin = args + skin = argsMap.params[0] first = true while (first || !skin) { first = false @@ -64,7 +64,7 @@ target ('default': "Installs a ScaffoldTags skin") { layouts: "${skinDir}/layouts", groovycode: "${skinDir}/src/groovy", css: "${skinDir}/css" ] - targets = [ scaffolding: "${pluginHome}/grails-app/views/scaffolding", + myTargets = [ scaffolding: "${scaffoldTagsPluginDir}/grails-app/views/scaffolding", templates: "${basedir}/src/templates/scaffolding", layouts: "${basedir}/grails-app/views/layouts", groovycode: "${basedir}/src/groovy", @@ -78,7 +78,7 @@ target ('default': "Installs a ScaffoldTags skin") { sources.each { sourceType, sourcePath -> sourceDir = new File(sourcePath) if (sourceDir.exists()) { - targetPath = targets[sourceType] + targetPath = myTargets[sourceType] targetDir = new File(targetPath) if (clearTargets.contains(sourceType)) { @@ -92,8 +92,8 @@ target ('default': "Installs a ScaffoldTags skin") { } else if (targetDir.exists()) { // Prompt the user if an overwrite will occur def sources = sourceDir.list().toList() - def targets = targetDir.list().toList() - def overlap = sources?.intersect(targets) + def myTargets = targetDir.list().toList() + def overlap = sources?.intersect(myTargets) if (!overlap?.empty) { println "Warning: Pre-existing files found in ${targetDir}" def hasNewer = false @@ -170,16 +170,16 @@ target ('default': "Installs a ScaffoldTags skin") { sourceDir = new File(sourcePath) if (sourceDir.exists() && (Ant.antProject.properties."skin.dir.${sourceType}.copy" != "n")) { - targetPath = targets[sourceType] + targetPath = myTargets[sourceType] if (Ant.antProject.properties."skin.dir.${sourceType}.delete" == "y") { println "Removing existing ${sourceType}..." Ant.delete(dir: targetPath) } def overwrite = (Ant.antProject.properties."skin.dir.${sourceType}.overwrite" != "n") if (overwrite) { - println "Installing skin '${skin}' ${sourceType}..." + println "Installing skin '${skin}' ${sourceType} into ${targetPath}..." } else { - println "Installing only newer files in skin '${skin}' ${sourceType}..." + println "Installing only newer files in skin '${skin}' ${sourceType}into ${targetPath}..." } // Create any directories that don't exist diff --git a/scaffoldtags/src/skins/dojo/templates/create.gsp b/scaffoldtags/src/skins/dojo/templates/create.gsp index ec48094..98d631c 100644 --- a/scaffoldtags/src/skins/dojo/templates/create.gsp +++ b/scaffoldtags/src/skins/dojo/templates/create.gsp @@ -1,3 +1,4 @@ +<%=packageName%> diff --git a/scaffoldtags/src/skins/dojo/templates/edit.gsp b/scaffoldtags/src/skins/dojo/templates/edit.gsp index bc85f98..d0f6f32 100644 --- a/scaffoldtags/src/skins/dojo/templates/edit.gsp +++ b/scaffoldtags/src/skins/dojo/templates/edit.gsp @@ -1,3 +1,4 @@ +<%=packageName%> diff --git a/scaffoldtags/src/skins/dojo/templates/list.gsp b/scaffoldtags/src/skins/dojo/templates/list.gsp index 5b852f5..0e98402 100644 --- a/scaffoldtags/src/skins/dojo/templates/list.gsp +++ b/scaffoldtags/src/skins/dojo/templates/list.gsp @@ -1,3 +1,4 @@ +<%=packageName%> diff --git a/scaffoldtags/src/skins/dojo/templates/show.gsp b/scaffoldtags/src/skins/dojo/templates/show.gsp index 57ed379..f3fd536 100644 --- a/scaffoldtags/src/skins/dojo/templates/show.gsp +++ b/scaffoldtags/src/skins/dojo/templates/show.gsp @@ -1,3 +1,4 @@ +<%=packageName%> diff --git a/scaffoldtags/src/skins/no-img-skin/templates/create.gsp b/scaffoldtags/src/skins/no-img-skin/templates/create.gsp index 59979a8..6a3d7a7 100644 --- a/scaffoldtags/src/skins/no-img-skin/templates/create.gsp +++ b/scaffoldtags/src/skins/no-img-skin/templates/create.gsp @@ -1,3 +1,4 @@ +<%=packageName%> diff --git a/scaffoldtags/src/skins/no-img-skin/templates/edit.gsp b/scaffoldtags/src/skins/no-img-skin/templates/edit.gsp index 357b624..a3a165f 100644 --- a/scaffoldtags/src/skins/no-img-skin/templates/edit.gsp +++ b/scaffoldtags/src/skins/no-img-skin/templates/edit.gsp @@ -1,3 +1,4 @@ +<%=packageName%> diff --git a/scaffoldtags/src/skins/no-img-skin/templates/list.gsp b/scaffoldtags/src/skins/no-img-skin/templates/list.gsp index 29fc0ae..336d20c 100644 --- a/scaffoldtags/src/skins/no-img-skin/templates/list.gsp +++ b/scaffoldtags/src/skins/no-img-skin/templates/list.gsp @@ -1,3 +1,4 @@ +<%=packageName%> diff --git a/scaffoldtags/src/skins/no-img-skin/templates/show.gsp b/scaffoldtags/src/skins/no-img-skin/templates/show.gsp index 1093fc2..7b15ba1 100644 --- a/scaffoldtags/src/skins/no-img-skin/templates/show.gsp +++ b/scaffoldtags/src/skins/no-img-skin/templates/show.gsp @@ -1,3 +1,4 @@ +<%=packageName%>