Add and use include files to generate a div that spans all WoTNS content.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 15 Sep 2011 15:58:04 +0000 (17:58 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 15 Sep 2011 15:58:04 +0000 (17:58 +0200)
src/main/java/net/pterodactylus/wotns/ui/web/WebInterface.java
src/main/resources/templates/addTarget.html
src/main/resources/templates/include/head.html [new file with mode: 0644]
src/main/resources/templates/include/tail.html [new file with mode: 0644]
src/main/resources/templates/index.html
src/main/resources/templates/manage.html
src/main/resources/templates/unknown.html

index cb9b40e..18daf46 100644 (file)
@@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException;
 import java.util.ArrayList;
 import java.util.List;
 
+import net.pterodactylus.util.template.ClassPathTemplateProvider;
 import net.pterodactylus.util.template.CollectionSortFilter;
 import net.pterodactylus.util.template.HtmlFilter;
 import net.pterodactylus.util.template.ReflectionAccessor;
@@ -63,6 +64,7 @@ public class WebInterface {
                CollectionSortFilter sortFilter = new CollectionSortFilter();
                sortFilter.addComparator(Identity.class, IdentityComparator.NAME);
                templateContextFactory.addFilter("sort", sortFilter);
+               templateContextFactory.addProvider(new ClassPathTemplateProvider(WebInterface.class));
        }
 
        //
index 9bae233..79f4d88 100644 (file)
@@ -1,2 +1,4 @@
+<%include include/head.html>
 <h1>Add target.</h1>
 <p>An error occured.</p>
+<%include include/tail.html>
\ No newline at end of file
diff --git a/src/main/resources/templates/include/head.html b/src/main/resources/templates/include/head.html
new file mode 100644 (file)
index 0000000..dff40ac
--- /dev/null
@@ -0,0 +1 @@
+<div id="wotns">
\ No newline at end of file
diff --git a/src/main/resources/templates/include/tail.html b/src/main/resources/templates/include/tail.html
new file mode 100644 (file)
index 0000000..7f5eaa3
--- /dev/null
@@ -0,0 +1 @@
+</div>
\ No newline at end of file
index 2da3f2d..2144e2f 100644 (file)
@@ -1,3 +1,4 @@
+<%include include/head.html>
 <h1>WoTNS</h1>
 <p>Yay, Index!</p>
 
@@ -24,3 +25,4 @@
                <button type="submit" name="enable">Enable</button>
        </form>
 <%/foreach>
+<%include include/tail.html>
\ No newline at end of file
index 3f50a8c..a585155 100644 (file)
@@ -1,3 +1,4 @@
+<%include include/head.html>
 <h1>Manage “<%ownIdentity.nickname|html>”</h1>
 <%foreach ownIdentity.targets target>
        <%first>
@@ -21,3 +22,4 @@
        <input type="text" name="target" value=""/>
        <button type="submit" name="add">Add</button>
 </form>
+<%include include/tail.html>
\ No newline at end of file
index 6fab8b9..4f16c62 100644 (file)
@@ -1,2 +1,4 @@
+<%include include/head.html>
 <h1>Unknown name</h1>
-<p>The name “<%shortName|html>” is unknown.</p>
\ No newline at end of file
+<p>The name “<%shortName|html>” is unknown.</p>
+<%include include/tail.html>
\ No newline at end of file