Skip to content

Commit 03e22bb

Browse files
committed
Don't apply layouts to templates automatically. Fixes #9902
In Grails 2 layouts were not automatically applied to templates rendered from a controller. This makes sense as these tend to be partials. This fixes the issue and reverts to the previous behaviour. Functional test found at grails/grails3-functional-tests@29f6fa18635898 a4fa6feabd0a1cf392d0f22306
1 parent b3731c2 commit 03e22bb

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

\

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Revert "Use Gradle embedded within the "grails" process. Fixes #9640"
2+
3+
This reverts commit 9134bc81f97a8227a5e7b635b8576e36149c6476.
4+
5+
# Please enter the commit message for your changes. Lines starting
6+
# with '#' will be ignored, and an empty message aborts the commit.
7+
# On branch 3.0.x
8+
# Your branch is up-to-date with 'origin/3.0.x'.
9+
#
10+
# You are currently bisecting, started from branch '06c1d57'.
11+
#
12+
# Changes to be committed:
13+
# modified: grails-shell/src/main/groovy/org/grails/cli/gradle/GradleUtil.groovy
14+
#
15+
# Untracked files:
16+
# gradle/test
17+
# grails-bootstrap/GRAILS-8488.patch
18+
# grails-keys.txt.asc
19+
# media/logos/grails-cupsonly-logo-black.svg
20+
# media/logos/grails-cupsonly-logo-white.svg
21+
# media/logos/grails-cupsonly-logo.svg
22+
# pubring.gpg
23+
# run.sh
24+
# secring.gpg
25+
# settings.xml
26+
# test.sh
27+
#

grails-plugin-controllers/src/main/groovy/grails/artefact/controller/support/ResponseRenderer.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ import org.grails.web.servlet.view.GroovyPageView
4646
import org.grails.web.sitemesh.GrailsLayoutDecoratorMapper
4747
import org.grails.web.sitemesh.GrailsLayoutView
4848
import org.grails.web.sitemesh.GroovyPageLayoutFinder
49+
import org.grails.web.sitemesh.SitemeshLayoutView
4950
import org.grails.web.util.GrailsApplicationAttributes
5051
import org.springframework.beans.factory.NoSuchBeanDefinitionException
5152
import org.springframework.beans.factory.annotation.Autowired
@@ -319,7 +320,13 @@ trait ResponseRenderer extends WebAttributes {
319320
throw new ControllerExecutionException("Unable to load template for uri [$templateUri]. Template not found.")
320321
}
321322

323+
322324
boolean renderWithLayout = (explicitSiteMeshLayout || webRequest.getCurrentRequest().getAttribute(GrailsLayoutDecoratorMapper.LAYOUT_ATTRIBUTE))
325+
// if automatic decoration occurred unwrap, since this is a partial
326+
if(view instanceof GrailsLayoutView) {
327+
view = ((GrailsLayoutView)view).getInnerView()
328+
}
329+
323330
if(renderWithLayout && groovyPageLayoutFinder) {
324331
applySiteMeshLayout webRequest.currentRequest, false, explicitSiteMeshLayout
325332
try {
@@ -329,6 +336,7 @@ trait ResponseRenderer extends WebAttributes {
329336
}
330337
}
331338

339+
332340
Map binding = [:]
333341

334342
if (argMap.containsKey(ARGUMENT_BEAN)) {

0 commit comments

Comments
 (0)