stk: improve templates (MGNLSTK-919)

[MGNLSTK-925] stk: improve templates: remove generic area scripts (listArea.ftl, singleArea.ftl) Created: 21/Feb/12  Updated: 22/Mar/12  Resolved: 22/Feb/12

Status: Closed
Project: Magnolia Standard Templating Kit (closed)
Component/s: None
Affects Version/s: None
Fix Version/s: 2.0

Type: Sub-task Priority: Major
Reporter: Philipp Bärfuss Assignee: Philipp Bärfuss
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:

 Description   

the area element should render its sub components if no script is defined, hence the default scripts are obsolete:

  • /magnolia-module-standard-templating-kit/src/main/resources/templating-kit/generic/listArea.ftl
  • /magnolia-module-standard-templating-kit/src/main/resources/templating-kit/generic/singleArea.ftl

to be done:

  • make sure the area element works as described
  • remove the script
  • remove all references to this scripts


 Comments   
Comment by Philipp Bärfuss [ 21/Feb/12 ]

patch:

### Eclipse Workspace Patch 1.0
#P magnolia-templating
Index: src/main/java/info/magnolia/templating/elements/AreaElement.java
===================================================================
--- src/main/java/info/magnolia/templating/elements/AreaElement.java	(revision 54613)
+++ src/main/java/info/magnolia/templating/elements/AreaElement.java	(working copy)
@@ -254,7 +254,15 @@
                 webContext.push(webContext.getRequest(), webContext.getResponse());
                 setAttributesInWebContext(contextAttributes, WebContext.LOCAL_SCOPE);
                 try {
-                    renderingEngine.render(areaNode, areaDefinition, contextObjects, new AppendableOnlyOutputProvider(out));
+                    AppendableOnlyOutputProvider appendable = new AppendableOnlyOutputProvider(out);
+                    if(StringUtils.isNotEmpty(areaDefinition.getTemplateScript())){
+                        renderingEngine.render(areaNode, areaDefinition, contextObjects, appendable);
+                    }
+                    else{
+                        for (ContentMap component : components) {
+                            renderingEngine.render(component.getJCRNode(), appendable);
+                        }
+                    }
                 } finally {
                     webContext.pop();
                     webContext.setPageContext(null);

Generated at Mon Feb 12 07:31:42 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.