mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR Removed scriptaculous dependency from TableField and TableListField, added jQuery dependency
This commit is contained in:
parent
895b98116d
commit
98f56069a9
@ -480,10 +480,9 @@ class TableField extends TableListField {
|
||||
* Sets the template to be rendered with
|
||||
*/
|
||||
function FieldHolder() {
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
|
||||
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableField.js');
|
||||
|
@ -295,10 +295,10 @@ class TableListField extends FormField {
|
||||
}
|
||||
|
||||
function FieldHolder() {
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/jquery/jquery.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/prototype/prototype.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/behaviour/behaviour.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/prototype_improvements.js');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/thirdparty/scriptaculous/effects.js');
|
||||
Requirements::add_i18n_javascript(SAPPHIRE_DIR . '/javascript/lang');
|
||||
Requirements::javascript(SAPPHIRE_DIR . '/javascript/TableListField.js');
|
||||
Requirements::css(SAPPHIRE_DIR . '/css/TableListField.css');
|
||||
|
@ -4,19 +4,6 @@
|
||||
*
|
||||
* TODO relies on include-order at the moment to override actions :/
|
||||
*/
|
||||
Effect.FadeOut = function(element,callback) {
|
||||
element = $(element);
|
||||
var oldOpacity = Element.getInlineOpacity(element);
|
||||
var options = Object.extend({
|
||||
from: Element.getOpacity(element) || 1.0,
|
||||
to: 0.0,
|
||||
afterFinishInternal: function(effect) {
|
||||
effect.element.parentNode.removeChild(effect.element);
|
||||
}
|
||||
}, arguments[1] || {});
|
||||
return new Effect.Opacity(element,options);
|
||||
}
|
||||
|
||||
TableField = Class.create();
|
||||
TableField.prototype = {
|
||||
|
||||
@ -61,7 +48,7 @@ TableField.prototype = {
|
||||
|| params["childID"] <= 0 || (recordID <= 0 || recordID == false)
|
||||
){
|
||||
if( row.parentNode.getElementsByTagName('tr').length > 1 ) {
|
||||
Effect.FadeOut(row);
|
||||
jQuery(row).fadeOut();
|
||||
} else {
|
||||
// clear all fields in the row
|
||||
var fields = row.getElementsByTagName('input');
|
||||
@ -83,20 +70,15 @@ TableField.prototype = {
|
||||
'method': 'post',
|
||||
'data': {ajax: 1, 'SecurityID': $('SecurityID') ? $('SecurityID').value : null},
|
||||
'success': function(response){
|
||||
Effect.Fade(
|
||||
row,
|
||||
{
|
||||
afterFinish: function(obj) {
|
||||
jQuery(row).fadeOut('fast', function() {
|
||||
// remove row from DOM
|
||||
obj.element.parentNode.removeChild(obj.element);
|
||||
this.element.parentNode.removeChild(obj.element);
|
||||
// recalculate summary if needed (assumes that TableListField.js is present)
|
||||
// TODO Proper inheritance
|
||||
if(self._summarise) self._summarise();
|
||||
// custom callback
|
||||
if(self.callback_deleteRecord) self.callback_deleteRecord(e);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
'error': ajaxErrorHandler
|
||||
});
|
||||
|
@ -99,20 +99,15 @@ TableListField.prototype = {
|
||||
'method': 'post',
|
||||
'data': {forceajax: 1, SecurityID: jQuery('input[name=SecurityID]').val()},
|
||||
'success': function(){
|
||||
Effect.Fade(
|
||||
row,
|
||||
{
|
||||
afterFinish: function(obj) {
|
||||
jQuery(row).fadeOut('fast', function() {
|
||||
// remove row from DOM
|
||||
obj.element.parentNode.removeChild(obj.element);
|
||||
this.element.parentNode.removeChild(obj.element);
|
||||
// recalculate summary if needed (assumes that TableListField.js is present)
|
||||
// TODO Proper inheritance
|
||||
if(self._summarise) self._summarise();
|
||||
// custom callback
|
||||
if(self.callback_deleteRecord) self.callback_deleteRecord(e);
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
'error': this.ajaxErrorHandler
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user