From: David ‘Bombe’ Roden Date: Fri, 28 Jan 2011 06:45:36 +0000 (+0100) Subject: Allow sender selection when sending a message on the “view Sone” page. X-Git-Tag: 0.4.4^2~16 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0acfe739424af48d5e075e48a0aa1890d160d3c8;p=Sone.git Allow sender selection when sending a message on the “view Sone” page. This fixes #99. --- 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 @@ + +
+ +
+