From a626746ba02e64402514c32a5317c33fdcd7be35 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 15 Sep 2011 17:58:04 +0200 Subject: [PATCH] Add and use include files to generate a div that spans all WoTNS content. --- src/main/java/net/pterodactylus/wotns/ui/web/WebInterface.java | 2 ++ src/main/resources/templates/addTarget.html | 2 ++ src/main/resources/templates/include/head.html | 1 + src/main/resources/templates/include/tail.html | 1 + src/main/resources/templates/index.html | 2 ++ src/main/resources/templates/manage.html | 2 ++ src/main/resources/templates/unknown.html | 4 +++- 7 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/main/resources/templates/include/head.html create mode 100644 src/main/resources/templates/include/tail.html diff --git a/src/main/java/net/pterodactylus/wotns/ui/web/WebInterface.java b/src/main/java/net/pterodactylus/wotns/ui/web/WebInterface.java index cb9b40e..18daf46 100644 --- a/src/main/java/net/pterodactylus/wotns/ui/web/WebInterface.java +++ b/src/main/java/net/pterodactylus/wotns/ui/web/WebInterface.java @@ -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)); } // diff --git a/src/main/resources/templates/addTarget.html b/src/main/resources/templates/addTarget.html index 9bae233..79f4d88 100644 --- a/src/main/resources/templates/addTarget.html +++ b/src/main/resources/templates/addTarget.html @@ -1,2 +1,4 @@ +<%include include/head.html>

Add target.

An error occured.

+<%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 index 0000000..dff40ac --- /dev/null +++ b/src/main/resources/templates/include/head.html @@ -0,0 +1 @@ +
\ 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 index 0000000..7f5eaa3 --- /dev/null +++ b/src/main/resources/templates/include/tail.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 2da3f2d..2144e2f 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -1,3 +1,4 @@ +<%include include/head.html>

WoTNS

Yay, Index!

@@ -24,3 +25,4 @@ <%/foreach> +<%include include/tail.html> \ No newline at end of file diff --git a/src/main/resources/templates/manage.html b/src/main/resources/templates/manage.html index 3f50a8c..a585155 100644 --- a/src/main/resources/templates/manage.html +++ b/src/main/resources/templates/manage.html @@ -1,3 +1,4 @@ +<%include include/head.html>

Manage “<%ownIdentity.nickname|html>”

<%foreach ownIdentity.targets target> <%first> @@ -21,3 +22,4 @@ +<%include include/tail.html> \ No newline at end of file diff --git a/src/main/resources/templates/unknown.html b/src/main/resources/templates/unknown.html index 6fab8b9..4f16c62 100644 --- a/src/main/resources/templates/unknown.html +++ b/src/main/resources/templates/unknown.html @@ -1,2 +1,4 @@ +<%include include/head.html>

Unknown name

-

The name “<%shortName|html>” is unknown.

\ No newline at end of file +

The name “<%shortName|html>” is unknown.

+<%include include/tail.html> \ No newline at end of file -- 2.7.4