mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
8c9f5900b5
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@39738 467b73ca-7a2a-4603-9d3b-597d59a354a9
42 lines
995 B
JavaScript
42 lines
995 B
JavaScript
CommentTableField = Class.create();
|
|
CommentTableField.prototype = {
|
|
initialize: function() {
|
|
var rules = {};
|
|
|
|
rules['#'+this.id+' table.data a.spamlink'] = {
|
|
onclick: this.removeRowAfterAjax.bind(this)
|
|
};
|
|
|
|
rules['#'+this.id+' table.data a.acceptlink'] = {
|
|
onclick: this.removeRowAfterAjax.bind(this)
|
|
};
|
|
|
|
rules['#'+this.id+' table.data a.hamlink'] = {
|
|
onclick: this.removeRowAfterAjax.bind(this)
|
|
};
|
|
|
|
Behaviour.register(rules);
|
|
},
|
|
|
|
removeRowAfterAjax: function(e) {
|
|
var img = Event.element(e);
|
|
var link = Event.findElement(e,"a");
|
|
var row = Event.findElement(e,"tr");
|
|
|
|
img.setAttribute("src",'cms/images/network-save.gif'); // TODO doesn't work in Firefox1.5+
|
|
new Ajax.Request(
|
|
link.getAttribute("href"),
|
|
{
|
|
method: 'post',
|
|
postBody: 'forceajax=1',
|
|
onComplete: function(){
|
|
Effect.Fade(row);
|
|
}.bind(this),
|
|
onFailure: ajaxErrorHandler
|
|
}
|
|
);
|
|
Event.stop(e);
|
|
}
|
|
}
|
|
|
|
CommentTableField.applyTo('div.CommentTableField'); |