fix remove comment button in the comments viewlet.

svn path=/plone.app.discussion/trunk/; revision=27815
This commit is contained in:
Timo Stollenwerk 2009-07-04 16:59:55 +00:00
parent e2934a66b1
commit 0c377e3c9b
2 changed files with 24 additions and 1 deletions

View File

@ -101,7 +101,8 @@
style="display: inline;" style="display: inline;"
tal:condition="view/can_manage" tal:condition="view/can_manage"
tal:attributes="action string:${reply/absolute_url}/@@moderate-delete-comment"> tal:attributes="action string:${reply/absolute_url}/@@moderate-delete-comment">
<input class="destructive" <input name="form.button.DeleteComment"
class="destructive"
type="submit" type="submit"
value="Remove" value="Remove"
i18n:attributes="value label_remove;" i18n:attributes="value label_remove;"

View File

@ -77,4 +77,26 @@ jq(document).ready(function() {
}); });
/*****************************************************************
* Remove comment.
*****************************************************************/
jq("input[name='form.button.DeleteComment']").click(function(e){
e.preventDefault();
var form = jq(this).parent();
var target = jq(form).attr("action");
var comment = jq(form).parent()
jq.ajax({
type: "GET",
url: target,
success: function(msg){
// fade out row
jq(comment).fadeOut("normal", function(){
jq(this).remove();
});
},
error: function(msg){
alert("Error sending AJAX request:" + target);
},
});
});
}); });