From: David ‘Bombe’ Roden Date: Fri, 26 Nov 2010 22:01:21 +0000 (+0100) Subject: Add possibility to post a message directly to another Sone. X-Git-Tag: 0.3.2-RC1~15^2~3 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=dab7b61577baa725e3b9343f69787153b6375196;p=Sone.git Add possibility to post a message directly to another Sone. --- diff --git a/src/main/resources/i18n/sone.en.properties b/src/main/resources/i18n/sone.en.properties index ad3f4b0..32ff6c6 100644 --- a/src/main/resources/i18n/sone.en.properties +++ b/src/main/resources/i18n/sone.en.properties @@ -89,6 +89,7 @@ Page.ViewSone.Title=View Sone - Sone Page.ViewSone.Page.TitleWithoutSone=View unknown Sone Page.ViewSone.NoSone.Description=There is currently no known Sone with the ID {sone}. If you were looking for a specific Sone, make sure that it is visible in your web of trust! Page.ViewSone.UnknownSone.Description=This Sone has not yet been retrieved. Please check back in a short time. +Page.ViewSone.WriteAMessage=You can write a message to this Sone here. Please note that everybody will be able to read this message! Page.ViewSone.PostList.Title=Posts by {sone} Page.ViewSone.PostList.Text.NoPostYet=This Sone has not yet posted anything. @@ -157,6 +158,7 @@ View.Post.LikeLink=Like View.Post.UnlikeLink=Unlike WebInterface.DefaultText.StatusUpdate=What’s on your mind? +WebInterface.DefaultText.Message=Write a Message… WebInterface.DefaultText.Reply=Write a Reply… WebInterface.DefaultText.FirstName=First name WebInterface.DefaultText.MiddleName=Middle name(s) diff --git a/src/main/resources/static/css/sone.css b/src/main/resources/static/css/sone.css index 608a4e8..2861575 100644 --- a/src/main/resources/static/css/sone.css +++ b/src/main/resources/static/css/sone.css @@ -177,7 +177,7 @@ textarea { min-height: 48px; } -#sone .post .author { +#sone .post .author, #sone .post .recipient { display: inline; font-weight: bold; } diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index 8be0282..7f09089 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -742,6 +742,21 @@ $(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").submit(function() { + text = $(this).find(":input:enabled").val(); + $.getJSON("ajax/createPost.ajax", { "formPassword": getFormPassword(), "recipient": $("#sone #sone-id").text(), "text": text }, function(data, textStatus) { + if ((data != null) && data.success) { + loadNewPost(data.postId); + } + }); + $(this).find(":input:enabled").val("").blur(); + return false; + }); + }); + /* Ajaxifies all posts. */ /* calling getTranslation here will cache the necessary values. */ getTranslation("WebInterface.Confirmation.DeletePostButton", function(text) { diff --git a/src/main/resources/templates/viewSone.html b/src/main/resources/templates/viewSone.html index 916b110..4d96fab 100644 --- a/src/main/resources/templates/viewSone.html +++ b/src/main/resources/templates/viewSone.html @@ -20,6 +20,16 @@ <%include include/viewSone.html> <%/if> +

<%= Page.ViewSone.WriteAMessage|l10n|html>

+ +
+ + + + + +
+

<%= Page.ViewSone.PostList.Title|l10n|insert needle="{sone}" key=sone.niceName|html>