MINOR Removed scriptaculous dependency from TableField and TableListField, added jQuery dependency

This commit is contained in:
Ingo Schommer 2011-04-19 22:47:56 +12:00
parent 895b98116d
commit 98f56069a9
4 changed files with 21 additions and 45 deletions

View File

@ -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');

View File

@ -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');

View File

@ -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
});

View File

@ -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
});