Add notifications for new posts and replies.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 12 Nov 2010 11:31:42 +0000 (12:31 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 12 Nov 2010 11:31:42 +0000 (12:31 +0100)
src/main/resources/i18n/sone.en.properties
src/main/resources/static/css/sone.css
src/main/resources/templates/include/head.html

index bc149d8..2da12e4 100644 (file)
@@ -197,5 +197,7 @@ WebInterface.SelectBox.Choose=Choose…
 WebInterface.SelectBox.Yes=Yes
 WebInterface.SelectBox.No=No
 WebInterface.ClickToShow.Replies=Click here to show hidden replies.
+WebInterface.Notification.NewPostCount=You have new posts:
+WebInterface.Notification.NewReplyCount=You have new replies:
 
 Warning.PluginNotConnected.Text=The Web of Trust plugin could not be found! This can happen if the Web of Trust plugin is not loaded or if your node is currently still starting up. In the first case, load the Web of Trust plugin using the {link}plugin manager{/link}, in the second case wait until the Web of Trust plugin has been loaded, because in either case Sone will not be working unless the Web of Trust plugin is loaded!
index 5f3e938..fb7587f 100644 (file)
@@ -53,6 +53,21 @@ textarea {
        margin-bottom: 1em;
 }
 
+#sone #notification-area .notification {
+       padding: 1ex;
+       border: solid 1px #ccc;
+       background-color: #ffffa0;
+       margin-bottom: 1ex;
+}
+
+#sone #notification-area .notification > div {
+       display: inline;
+}
+
+#sone #notification-area .notification .post-count {
+       margin-left: 1ex;
+}
+
 #sone #plugin-warning {
        border: solid 0.5em red;
        padding: 0.5em;
index 809bd57..deb020c 100644 (file)
                });
        </script>
 
+       <script language="javascript">
+               /* display large notification about new replies and posts. */
+               $(document).ready(function() {
+                       newPostCount = $("#sone .post.new").length;
+                       newReplyCount = $("#sone .reply.new").length;
+                       if ((newPostCount + newReplyCount) == 0) {
+                               return;
+                       }
+                       if (newPostCount > 0) {
+                               postNotification = $("<div></div>").addClass("notification");
+                               getTranslation("WebInterface.Notification.NewPostCount", function(text) {
+                                       postNotification.append($("<div></div>").text(text)).append($("<div></div>").addClass("post-count").text(newPostCount));
+                               });
+                               postNotification.appendTo("#sone #notification-area");
+                       }
+                       if (newReplyCount > 0) {
+                               replyNotification = $("<div></div>").addClass("notification");
+                               getTranslation("WebInterface.Notification.NewReplyCount", function(text) {
+                                       replyNotification.append($("<div></div>").text(text)).append($("<div></div>").addClass("post-count").text(newReplyCount));
+                               });
+                               replyNotification.appendTo("#sone #notification-area");
+                       }
+               });
+       </script>
+
        <div id="main">
 
                <%if !webInterface.core.identityManager.connected>