Ajaxify notifications and the “mark as read” button.
[Sone.git] / src / main / resources / static / javascript / sone.js
index e084d87..5922717 100644 (file)
@@ -677,7 +677,7 @@ function ajaxifyReply(replyElement) {
  *            jQuery object representing the notification.
  */
 function ajaxifyNotification(notification) {
-       notification.find("form.dismiss").submit(function() {
+       notification.find("form").submit(function() {
                return false;
        });
        notification.find("input[name=returnPage]").val($.url.attr("relative"));
@@ -685,6 +685,9 @@ function ajaxifyNotification(notification) {
                notification.find(".short-text").removeClass("hidden");
                notification.find(".text").addClass("hidden");
        }
+       notification.find("form.mark-as-read button").click(function() {
+               $.getJSON("markAsKnown.ajax", {"formPassword": getFormPassword(), "type": $(":input[name=type]", this.form).val(), "id": $(":input[name=id]", this.form).val()});
+       });
        notification.find("form.dismiss button").click(function() {
                $.getJSON("dismissNotification.ajax", { "formPassword" : getFormPassword(), "notification" : notification.attr("id") }, function(data, textStatus) {
                        /* dismiss in case of error, too. */