From: David ‘Bombe’ Roden Date: Tue, 19 Oct 2010 20:35:36 +0000 (+0200) Subject: Return to correct page when user tries to post an empty post. X-Git-Tag: 0.1-RC1~172 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=b05da8b28547c757aa986306c9e88bc5521b174c;p=Sone.git Return to correct page when user tries to post an empty post. --- diff --git a/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java b/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java index d2bd5da..05aceac 100644 --- a/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java +++ b/src/main/java/net/pterodactylus/sone/web/CreatePostPage.java @@ -51,6 +51,7 @@ public class CreatePostPage extends SoneTemplatePage { @Override protected void processTemplate(Request request, Template template) throws RedirectException { super.processTemplate(request, template); + template.set("returnPage", request.getUri()); if (request.getMethod() == Method.POST) { String text = request.getHttpRequest().getPartAsStringFailsafe("text", 65536).trim(); String returnPage = request.getHttpRequest().getPartAsStringFailsafe("returnPage", 64); @@ -60,7 +61,9 @@ public class CreatePostPage extends SoneTemplatePage { throw new RedirectException(returnPage); } template.set("errorTextEmpty", true); + template.set("returnPage", returnPage); } + } // diff --git a/src/main/resources/templates/createPost.html b/src/main/resources/templates/createPost.html index de1196b..ca9171b 100644 --- a/src/main/resources/templates/createPost.html +++ b/src/main/resources/templates/createPost.html @@ -8,6 +8,7 @@
+