NIHVIVO-564 Add name of containing template to dataModelDump output

This commit is contained in:
rjy7 2010-07-29 14:03:27 +00:00
parent 1ccde72b40
commit 2a50ff7f85
3 changed files with 6 additions and 7 deletions

View file

@ -72,7 +72,10 @@ public class DumpDataModelDirective implements TemplateDirectiveModel {
map.put("stylesheets", dataModel.get("stylesheets"));
map.put("dump", dataModel.get("dump"));
// Put the current datamodel into the new datamodel so its values can be dumped with the dump directive
// RY Another way to do this would be to loop through the data model here, merging each variable with
// the dump-var.ftl template and adding it to the output string.
map.put("datamodel", dataModel);
map.put("containingTemplate", env.getTemplate().getName());
FreemarkerHelper helper = new FreemarkerHelper();
String output = helper.mergeMapToTemplate(templateName, map, config);

View file

@ -105,13 +105,9 @@ public class DumpDirective implements TemplateDirectiveModel {
map.put("type", type);
map.put("stylesheets", dataModel.get("stylesheets"));
//map.put("dump", this);
Configuration config = env.getConfiguration();
String templateName = "dump-var.ftl";
FreemarkerHelper helper = new FreemarkerHelper();
String output = helper.mergeMapToTemplate(templateName, map, config);
//map.put("dump", this); // would need for recursive calls
String output = new FreemarkerHelper().mergeMapToTemplate("dump-var.ftl", map, env.getConfiguration());
Writer out = env.getOut();
out.write(output);

View file

@ -4,7 +4,7 @@
<div class="dump datamodel">
<h4>Template data model dump</h6>
<h4>Data Model Dump for Template <em>${containingTemplate}</em></h6>
<h5>Variables</h5>