From: David ‘Bombe’ Roden Date: Wed, 19 Jan 2011 18:11:40 +0000 (+0100) Subject: Ajaxify notifications and the “mark as read” button. X-Git-Tag: 0.4.2^2~27^2 X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=commitdiff_plain;h=0fd7000d91d4bcb417af27b009b546c7b0f38cc0 Ajaxify notifications and the “mark as read” button. --- diff --git a/src/main/resources/static/javascript/sone.js b/src/main/resources/static/javascript/sone.js index e084d87..5922717 100644 --- a/src/main/resources/static/javascript/sone.js +++ b/src/main/resources/static/javascript/sone.js @@ -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. */