Commits

Sam Adams  committed 69cc165

Migrate search form to new skin/templates

  • Participants
  • Parent commits 5778179

Comments (0)

Files changed (2)

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

 import net.chempound.datastore.TripleStore;
 import net.chempound.datastore.UriResultHandler;
 import net.chempound.services.FreemarkerService;
+import net.chempound.webapp.output.Page;
 import org.restlet.data.Form;
 import org.restlet.data.MediaType;
 import org.restlet.data.Status;
     }
 
     private Representation generateSearchForm() throws IOException {
-        final Map<String,Object> model = new HashMap<String, Object>();
+        final Page page = new Page(null);
         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>\n",
-                "    <script src='/plugins/jquery/jquery-ui-1.8.14.min.js' type='text/javascript'></script>\n",
-                "    <link href='/plugins/jquery/smoothness/jquery-ui-1.8.14.css' rel='stylesheet' type='text/css'/>\n"
-        ));
+        page.addParam("providers", providers);
         final Template template = freemarker.getTemplate("search-form.ftl");
-        return new TemplateRepresentation(template, model, MediaType.TEXT_HTML);
+        return new TemplateRepresentation(template, page.getModel(), MediaType.TEXT_HTML);
     }
 
     private Representation handleQuery(final Form form) throws IOException {

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

+<@layout.header>
+<script src='${URI_BASE}/plugins/jquery/jquery-1.4.2.js' type='text/javascript'></script>
+<script src='${URI_BASE}/plugins/jquery/jquery-ui-1.8.14.min.js' type='text/javascript'></script>
+<link href='${URI_BASE}/plugins/jquery/smoothness/jquery-ui-1.8.14.css' rel='stylesheet' type='text/css'/>
+</@layout.header>
 <@layout.page
     title="Search"
 >