mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
BUGFIX: Removed use of deprecated TableListField_Item::BaseLink() And TableListField::ajax_refresh() from CommentTableField and MemberTableField
BUGFIX: Fixed styling, searching, and pagination of CommentTableField git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@61686 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
9222af6829
commit
b4e681dc83
@ -172,15 +172,15 @@ class CommentTableField_Item extends ComplexTableField_Item {
|
||||
}
|
||||
|
||||
function SpamLink() {
|
||||
return $this->BaseLink() . "&methodName=spam";
|
||||
return Controller::join_links($this->Link(), "?methodName=spam");
|
||||
}
|
||||
|
||||
function HamLink() {
|
||||
return $this->BaseLink() . "&methodName=ham";
|
||||
return Controller::join_links($this->Link(), "?methodName=ham");
|
||||
}
|
||||
|
||||
function ApproveLink() {
|
||||
return $this->BaseLink() . "&methodName=approve";
|
||||
return Controller::join_links($this->Link(), "?methodName=approve");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,13 +14,10 @@ CommentTableField.prototype = {
|
||||
rules['#'+this.id+' table.data a.hamlink'] = {
|
||||
onclick: this.removeRowAfterAjax.bind(this)
|
||||
};
|
||||
|
||||
rules['#Form_EditForm div.CommentFilter input'] = {
|
||||
onkeypress : this.prepareSearch.bind(this)
|
||||
};
|
||||
|
||||
|
||||
|
||||
rules['#Form_EditForm'] = {
|
||||
changeDetection_fieldsToIgnore : {
|
||||
'ctf[start]' : true,
|
||||
@ -76,7 +73,7 @@ CommentTableField.prototype = {
|
||||
CommentTableField.applyTo('div.CommentTableField');
|
||||
|
||||
CommentFilterButton = Class.create();
|
||||
CommentFilterButton.applyTo('#Form_EditForm #CommentFilterButton');
|
||||
CommentFilterButton.applyTo('#CommentFilterButton');
|
||||
CommentFilterButton.prototype = {
|
||||
initialize: function() {
|
||||
this.inputFields = new Array();
|
||||
@ -107,28 +104,30 @@ CommentFilterButton.prototype = {
|
||||
},
|
||||
|
||||
onclick: function(e) {
|
||||
//if(!$('ctf-ID') || !$('CommentFieldName')) {
|
||||
// return false;
|
||||
//}
|
||||
try {
|
||||
var form = Event.findElement(e,"form");
|
||||
var fieldName = $('CommentFieldName').value;
|
||||
var fieldID = form.id + '_' + fieldName;
|
||||
|
||||
var updateURL = "";
|
||||
updateURL += Event.findElement(e,"form").action;
|
||||
// we can't set "fieldName" as a HiddenField because there might be multiple ComplexTableFields in a single EditForm-container
|
||||
updateURL += "&fieldName="+$('CommentFieldName').value;
|
||||
updateURL += "&action_callfieldmethod&&methodName=ajax_refresh&";
|
||||
var updateURL = form.action + '/field/' + fieldName + '?ajax=1';
|
||||
for( var index = 0; index < this.inputFields.length; index++ ) {
|
||||
if( this.inputFields[index].tagName ) {
|
||||
updateURL += this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value ) + '&';
|
||||
updateURL += '&' + this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value );
|
||||
}
|
||||
}
|
||||
updateURL += 'ajax=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
||||
updateURL += ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
||||
|
||||
new Ajax.Request( updateURL, {
|
||||
onSuccess: Ajax.Evaluator,
|
||||
new Ajax.Updater( fieldID, updateURL, {
|
||||
onSuccess: function() {
|
||||
Behaviour.apply(fieldID, true);
|
||||
},
|
||||
onFailure: function( response ) {
|
||||
errorMessage('Could not filter results: ' + response.responseText );
|
||||
}.bind(this)
|
||||
});
|
||||
} catch(er) {
|
||||
errorMessage('Error searching');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -244,22 +244,30 @@ MemberFilterButton.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
var updateURL = "";
|
||||
updateURL += Event.findElement(e,"form").action;
|
||||
updateURL += '/field/' + $('MemberFieldName').value + '/ajax_refresh?ajax=1&';
|
||||
try {
|
||||
var form = Event.findElement(e,"form");
|
||||
var fieldName = $('MemberFieldName').value;
|
||||
var fieldID = form.id + '_' + fieldName;
|
||||
|
||||
var updateURL = form.action + '/field/' + fieldName + '?ajax=1';
|
||||
for( var index = 0; index < this.inputFields.length; index++ ) {
|
||||
if( this.inputFields[index].tagName ) {
|
||||
updateURL += this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value ) + '&';
|
||||
updateURL += '&' + this.inputFields[index].name + '=' + encodeURIComponent( this.inputFields[index].value );
|
||||
}
|
||||
}
|
||||
updateURL += 'ajax=1' + ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
||||
updateURL += ($('SecurityID') ? '&SecurityID=' + $('SecurityID').value : '');
|
||||
|
||||
new Ajax.Request( updateURL, {
|
||||
onSuccess: Ajax.Evaluator,
|
||||
new Ajax.Updater( fieldID, updateURL, {
|
||||
onSuccess: function() {
|
||||
Behaviour.apply(fieldID, true);
|
||||
},
|
||||
onFailure: function( response ) {
|
||||
errorMessage('Could not filter results: ' + response.responseText );
|
||||
}.bind(this)
|
||||
});
|
||||
} catch(er) {
|
||||
errorMessage('Error searching');
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
<div id="$id" class="$Classes">
|
||||
<div id="$id" class="$CSSClasses">
|
||||
<div class="CommentFilter">
|
||||
$SearchForm
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user