From 0acfe739424af48d5e075e48a0aa1890d160d3c8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Fri, 28 Jan 2011 07:45:36 +0100 Subject: [PATCH] =?utf8?q?Allow=20sender=20selection=20when=20sending=20a?= =?utf8?q?=20message=20on=20the=20=E2=80=9Cview=20Sone=E2=80=9D=20page.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes #99. --- src/main/resources/static/css/sone.css | 8 ++++---- src/main/resources/static/javascript/sone.js | 17 ++++++++++++++--- src/main/resources/templates/viewSone.html | 9 +++++++++ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index c5d8e9a..676a9d5 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -164,7 +164,7 @@ textarea { margin-bottom: 1em; } -#sone #update-status label { +#sone #update-status label, #sone #post-message label { display: none; } @@ -180,11 +180,11 @@ textarea { float: right; } -#sone #update-status .select-sender, #sone .create-reply .select-sender { +#sone #update-status .select-sender, #sone .create-reply .select-sender, #sone #post-message .select-sender { display: none; } -#sone #update-status .select-sender button { +#sone #update-status .select-sender button, #sone #post-message .select-sender button { display: inline; float: left; } @@ -392,7 +392,7 @@ textarea { float: right; } -#sone .create-reply .select-sender button { +#sone .create-reply .select-sender button, #sone #post-message .select-sender button { display: inline; float: left; } diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index fb16b97..6c396f8 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -1248,14 +1248,25 @@ $(document).ready(function() { /* ajaxify input field on “view Sone” page. */ getTranslation("WebInterface.DefaultText.Message", function(defaultText) { registerInputTextareaSwap("#sone #post-message input[name=text]", defaultText, "text", false, false); + $("#sone #post-message .select-sender").css("display", "inline"); + $("#sone #post-message .sender").hide(); + $("#sone #post-message .select-sender button").click(function() { + $("#sone #post-message .sender").show(); + $("#sone #post-message .select-sender").hide(); + return false; + }); $("#sone #post-message").submit(function() { - text = $(this).find(":input:enabled").val(); - $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "recipient": getShownSoneId(), "text": text }, function(data, textStatus) { + sender = $(this).find(":input[name=sender]").val(); + text = $(this).find(":input[name=text]:enabled").val(); + $.getJSON("createPost.ajax", { "formPassword": getFormPassword(), "recipient": getShownSoneId(), "sender": sender, "text": text }, function(data, textStatus) { if ((data != null) && data.success) { loadNewPost(data.postId, getCurrentSoneId()); } }); - $(this).find(":input:enabled").val("").blur(); + $(this).find(":input[name=sender]").val(getCurrentSoneId()); + $(this).find(":input[name=text]:enabled").val("").blur(); + $(this).find(".sender").hide(); + $(this).find(".select-sender").show(); return false; }); }); diff --git a/src/main/resources/templates/viewSone.html b/src/main/resources/templates/viewSone.html index 4b2502a..d2a8f6e 100644 --- a/src/main/resources/templates/viewSone.html +++ b/src/main/resources/templates/viewSone.html @@ -43,6 +43,15 @@ + +
+ +
+
-- 2.7.4