Don’t show “web of trust is missing” notification the old way.
[Sone.git] / src / main / resources / templates / include / head.html
index 2a2d3b6..7b6cc28 100644 (file)
        </script>
 
        <script language="javascript">
-               /* display large notification about new replies and posts. */
+               /* process all existing notifications, ajaxify dismiss buttons. */
                $(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");
-                       }
+                       $("#sone #notification-area .notification").each(function() {
+                               ajaxifyNotification($(this));
+                       });
                });
        </script>
 
-       <div id="main">
+       <script language="javascript">
+               /* activate notification polling. */
+               $(document).ready(function() {
+                       setTimeout(getNotifications, 5000);
+               });
+       </script>
 
-               <%if !webInterface.core.identityManager.connected>
-                       <div id="plugin-warning">
-                               <%= Warning.PluginNotConnected.Text|l10n|html|replace needle="{link}" replacement="<a href=\"/plugins/\">"|replace needle="{/link}" replacement="</a>">
-                       </div>
-               <%/if>
+       <div id="main">
 
                <div id="notification-area">
-                       <%foreach webInterface.core.notifications.all notification>
-                               <div class="notification">
+
+                       <form id="notification-dismiss-template" class="hidden dismiss" action="dismissNotification.html" method="post">
+                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                               <input type="hidden" name="notification" value="" />
+                               <button type="submit"><%= Notification.Button.Dismiss|l10n|html></button>
+                       </form>
+
+                       <%foreach webInterface.notifications.all notification>
+                               <div class="notification" id="<% notification.id|html>">
                                        <%if notification.dismissable>
                                                <form class="dismiss" action="dismissNotification.html" method="post">
                                                        <input type="hidden" name="formPassword" value="<% formPassword|html>" />
                                                        <button type="submit"><%= Notification.Button.Dismiss|l10n|html></button>
                                                </form>
                                        <%/if>
-                                       <% notification.render>
+                                       <% notification>
                                </div>
                        <%/foreach>
                </div>