Some renaming in dump directives
This commit is contained in:
parent
9311e83827
commit
528414e4c7
6 changed files with 14 additions and 14 deletions
|
@ -283,7 +283,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
|
||||||
// Add any Java directives the templates should have access to
|
// Add any Java directives the templates should have access to
|
||||||
private void addDirectives(Map<String, Object> map) {
|
private void addDirectives(Map<String, Object> map) {
|
||||||
map.put("dump", new edu.cornell.mannlib.vitro.webapp.web.directives.DumpDirective());
|
map.put("dump", new edu.cornell.mannlib.vitro.webapp.web.directives.DumpDirective());
|
||||||
map.put("dumpDataModel", new edu.cornell.mannlib.vitro.webapp.web.directives.DumpDataModelDirective());
|
map.put("dumpAll", new edu.cornell.mannlib.vitro.webapp.web.directives.DumpAllDirective());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add variables that should be available only to the page's root map, not to the body.
|
// Add variables that should be available only to the page's root map, not to the body.
|
||||||
|
|
|
@ -25,9 +25,9 @@ import freemarker.template.TemplateModel;
|
||||||
import freemarker.template.TemplateModelException;
|
import freemarker.template.TemplateModelException;
|
||||||
import freemarker.template.utility.DeepUnwrap;
|
import freemarker.template.utility.DeepUnwrap;
|
||||||
|
|
||||||
public class DumpDataModelDirective extends BaseTemplateDirectiveModel {
|
public class DumpAllDirective extends BaseTemplateDirectiveModel {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(DumpDataModelDirective.class);
|
private static final Log log = LogFactory.getLog(DumpAllDirective.class);
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
@Override
|
@Override
|
||||||
|
@ -36,15 +36,15 @@ public class DumpDataModelDirective extends BaseTemplateDirectiveModel {
|
||||||
|
|
||||||
if (params.size() != 0) {
|
if (params.size() != 0) {
|
||||||
throw new TemplateModelException(
|
throw new TemplateModelException(
|
||||||
"The dumpDataModel directive doesn't allow parameters.");
|
"The dumpAll directive doesn't allow parameters.");
|
||||||
}
|
}
|
||||||
if (loopVars.length != 0) {
|
if (loopVars.length != 0) {
|
||||||
throw new TemplateModelException(
|
throw new TemplateModelException(
|
||||||
"The dumpDataModel directive doesn't allow loop variables.");
|
"The dumpAll directive doesn't allow loop variables.");
|
||||||
}
|
}
|
||||||
if (body != null) {
|
if (body != null) {
|
||||||
throw new TemplateModelException(
|
throw new TemplateModelException(
|
||||||
"The dumpDataModel directive doesn't allow nested content.");
|
"The dumpAll directive doesn't allow nested content.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration config = env.getConfiguration();
|
Configuration config = env.getConfiguration();
|
||||||
|
@ -69,7 +69,7 @@ public class DumpDataModelDirective extends BaseTemplateDirectiveModel {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String templateName = "dump-datamodel.ftl";
|
String templateName = "dump-all.ftl";
|
||||||
|
|
||||||
Map<String, Object> map = new HashMap<String, Object>();
|
Map<String, Object> map = new HashMap<String, Object>();
|
||||||
map.put("models", models);
|
map.put("models", models);
|
||||||
|
@ -96,7 +96,7 @@ public class DumpDataModelDirective extends BaseTemplateDirectiveModel {
|
||||||
String name = getDirectiveName();
|
String name = getDirectiveName();
|
||||||
map.put("name", name);
|
map.put("name", name);
|
||||||
|
|
||||||
map.put("usage", "Dump the contents of the template data model.");
|
map.put("effect", "Dump the contents of the template data model.");
|
||||||
|
|
||||||
map.put("comments", "Sequences (lists and arrays) are enclosed in square brackets. Hashes are enclosed in curly braces.");
|
map.put("comments", "Sequences (lists and arrays) are enclosed in square brackets. Hashes are enclosed in curly braces.");
|
||||||
|
|
|
@ -128,7 +128,7 @@ public class DumpDirective extends BaseTemplateDirectiveModel {
|
||||||
String name = getDirectiveName();
|
String name = getDirectiveName();
|
||||||
map.put("name", name);
|
map.put("name", name);
|
||||||
|
|
||||||
map.put("usage", "Dump the contents of a template variable.");
|
map.put("effect", "Dump the contents of a template variable.");
|
||||||
|
|
||||||
map.put("comments", "Sequences (lists and arrays) are enclosed in square brackets. Hashes are enclosed in curly braces.");
|
map.put("comments", "Sequences (lists and arrays) are enclosed in square brackets. Hashes are enclosed in curly braces.");
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
<div class="dump directive">
|
<div class="dump directive">
|
||||||
<p><strong>Directive name:</strong> ${name}</p>
|
<p><strong>Directive name:</strong> ${name}</p>
|
||||||
|
|
||||||
<#if usage??>
|
<#if effect??>
|
||||||
<p><strong>Usage:</strong> ${usage}</p>
|
<p><strong>Effect:</strong> ${effect}</p>
|
||||||
|
|
||||||
<#if comments??>
|
<#if comments??>
|
||||||
<p><strong>Comments:</strong> ${comments}</p>
|
<p><strong>Comments:</strong> ${comments}</p>
|
||||||
|
|
|
@ -52,11 +52,11 @@
|
||||||
<@dump var="fruit" />
|
<@dump var="fruit" />
|
||||||
<@dump var="trueStatement" />
|
<@dump var="trueStatement" />
|
||||||
<@dump var="falseStatement" />
|
<@dump var="falseStatement" />
|
||||||
<@dump var="zoo1" /> -->
|
<@dump var="zoo1" />
|
||||||
|
-->
|
||||||
|
|
||||||
${stylesheets.addFromTheme("/sstest.css", "/sstest2.css")}
|
${stylesheets.addFromTheme("/sstest.css", "/sstest2.css")}
|
||||||
${scripts.addFromTheme("/jstest.js")}
|
${scripts.addFromTheme("/jstest.js")}
|
||||||
${scripts.add("/js/script1.js", "/js/script2.js", "/js/script3.js")}
|
${scripts.add("/js/script1.js", "/js/script2.js", "/js/script3.js")}
|
||||||
|
|
||||||
<@dumpDataModel />
|
<@dumpAll />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue