From b7d7b2d4441e1b8be0ee1cafb05c361b275971a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 20 Jan 2011 07:00:12 +0100 Subject: [PATCH] Store the notification in itself when rendering. --- src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java index 71cc156..fd9ae76 100644 --- a/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java +++ b/src/main/java/net/pterodactylus/sone/web/ajax/GetStatusAjaxPage.java @@ -37,6 +37,7 @@ import net.pterodactylus.util.json.JsonArray; import net.pterodactylus.util.json.JsonObject; import net.pterodactylus.util.notify.Notification; import net.pterodactylus.util.notify.TemplateNotification; +import net.pterodactylus.util.template.TemplateContext; /** * The “get status” AJAX handler returns all information that is necessary to @@ -171,7 +172,9 @@ public class GetStatusAjaxPage extends JsonPage { StringWriter notificationWriter = new StringWriter(); try { if (notification instanceof TemplateNotification) { - ((TemplateNotification) notification).render(webInterface.getTemplateContextFactory().createTemplateContext().mergeContext(((TemplateNotification) notification).getTemplateContext()), notificationWriter); + TemplateContext templateContext = webInterface.getTemplateContextFactory().createTemplateContext().mergeContext(((TemplateNotification) notification).getTemplateContext()); + templateContext.set("notification", notification); + ((TemplateNotification) notification).render(templateContext, notificationWriter); } else { notification.render(notificationWriter); } -- 2.7.4