Anonymous avatar Anonymous committed d133b28

Fix compchem and crystallography templates

Comments (0)

Files changed (3)

crystallography-handler/src/main/java/net/chempound/crystal/display/CrystalStructureSplashPageWriter.java

 import net.chempound.rdf.DCTerms;
 import net.chempound.webapp.output.AbstractSplashPageWriter;
 import net.chempound.webapp.output.Page;
-import org.apache.commons.io.IOUtils;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URI;
 
 /**
  */
 public class CrystalStructureSplashPageWriter extends AbstractSplashPageWriter {
 
-    private static final String headers;
-
-    static {
-        headers = read("/net/chempound/crystal/includes/headers.html");
-    }
-
-    private static String read(final String s) {
-        final InputStream in = CrystalStructureSplashPageWriter.class.getResourceAsStream(s);
-        try {
-            return IOUtils.toString(in);
-        } catch (IOException e) {
-            throw new RuntimeException("Error reading file: " + s, e);
-        } finally {
-            IOUtils.closeQuietly(in);
-        }
-    }
-
     @Override
     protected Class<? extends Resource> getResourceType() {
         return CrystalStructure.class;
 
     @Override
     public void write(final Model model, final URI aggregationUri, final Page page) throws IOException, TemplateException {
-        page.addHeader(headers);
-
         final BeansWrapper wrapper = BeansWrapper.getDefaultInstance();
         final TemplateHashModel staticModels = wrapper.getStaticModels();
 

crystallography-handler/src/main/resources/net/chempound/crystal/includes/headers.html

-    <!-- import jmol -->
-    <script src="${URI_BASE}/plugins/jmol/jmol/Jmol.js" type="text/javascript"></script>
-
-    <!-- import jquery -->
-    <script src="${URI_BASE}/plugins/jquery/jquery-1.4.2.js" type="text/javascript"></script>
-
-    <!-- import jmol-jquery -->
-    <script src="${URI_BASE}/plugins/jmol/jquery.jmol.js" type="text/javascript"></script>
-    <!-- import style sheet -->
-    <link href="${URI_BASE}/plugins/jmol/jquery.jmol.css" type="text/css" rel="stylesheet" />

crystallography-handler/src/main/resources/net/chempound/crystal/templates/crystal.ftl

 <#-- @ftlvariable name="_" type="net.chempound.crystal.rdf.CrystalStructure" -->
+<@layout.header>
+    <!-- setup Jmol -->
+    <script src="${URI_BASE}/plugins/jmol/jmol/Jmol.js" type="text/javascript"></script>
+    <script src="${URI_BASE}/plugins/jquery/jquery-1.4.2.js" type="text/javascript"></script>
+    <script src="${URI_BASE}/plugins/jmol/jquery.jmol.js" type="text/javascript"></script>
+    <link href="${URI_BASE}/plugins/jmol/jquery.jmol.css" type="text/css" rel="stylesheet" />"
+</@layout.header>
+<@layout.page>
 <div class="crystaleye-structure">
 
     <h1><#if _.title??>${_.title}<#else>${uri}</#if></h1>
         });
     });
 </script>
+</@layout.page>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.