Commits

Anonymous committed 1f3817d

Move header definitions out of templates

Comments (0)

Files changed (4)

chempound-webapp/src/main/java/net/chempound/webapp/search/SearchResource.java

         final Map<String,Object> model = new HashMap<String, Object>();
         final List<SearchProvider> providers = searchProviderRegistry.getSearchProviderList();
         model.put("providers", providers);
+        model.put("headers", Arrays.asList(
+                "<script src='/plugins/jquery/jquery-1.4.2.js' type='text/javascript'></script>",
+                "<script src='/plugins/jquery/jquery-ui-1.8.14.min.js' type='text/javascript'></script>",
+                "<link href='/plugins/jquery/smoothness/jquery-ui-1.8.14.css' rel='stylesheet' type='text/css' />"
+        ));
         final Template template = freemarker.getTemplate("search-form.ftl");
         return new TemplateRepresentation(template, model, MediaType.TEXT_HTML);
     }

chempound-webapp/src/main/resources/net/chempound/templates/include/layout.ftl

 <#list STYLESHEETS as stylesheet>
     <link rel="stylesheet" href="${stylesheet}"/>
 </#list>
-<#if stylesheets??>
+<#if stylesheets?has_content>
 <#list stylesheets as stylesheet>
     <link rel="stylesheet" href="${stylesheet}"/>
 </#list>
 </#if>
-<#if headers??>
+<#if headers?has_content>
 <#list headers as header>
 <#assign headerTemplate = header?interpret>
 <@headerTemplate />

chempound-webapp/src/main/resources/net/chempound/templates/index.ftl

 <#-- @ftlvariable name="@" type="net.chempound.webapp.GlobalData" -->
-<#assign headers in layout>
-<link rel="http://purl.org/net/sword/discovery/service-document" href="${@.serviceDocument}" />
-</#assign>
 <@layout.basic>
 
 <h1>${@.data.frontPageTitle}</h1>

chempound-webapp/src/main/resources/net/chempound/templates/search-form.ftl

-<#assign headers in layout>
-<script src='/plugins/jquery/jquery-1.4.2.js' type='text/javascript'></script>
-<script src='/plugins/jquery/jquery-ui-1.8.14.min.js' type='text/javascript'></script>
-<link href='/plugins/jquery/smoothness/jquery-ui-1.8.14.css' rel='stylesheet' type='text/css' />
-</#assign>
 <@layout.basic
     title="Search"
 >