Permalink
Browse files

MINOR Removed scriptaculous dependency from TableField and TableListF…

…ield, added jQuery dependency
  • Loading branch information...
1 parent 895b981 commit 98f56069a94d13e52acffc747c5ae61a0da404d7 @chillu chillu committed Apr 19, 2011
Showing with 21 additions and 45 deletions.
  1. +1 −2 forms/TableField.php
  2. +1 −1 forms/TableListField.php
  3. +10 −28 javascript/TableField.js
  4. +9 −14 javascript/TableListField.js
View
3 forms/TableField.php
@@ -480,10 +480,9 @@ function getExtraData() {
* 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
2 forms/TableListField.php
@@ -295,10 +295,10 @@ function handleItem($request) {
}
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
38 javascript/TableField.js
@@ -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) {
- // remove row from DOM
- obj.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);
- }
- }
- );
+ jQuery(row).fadeOut('fast', function() {
+ // remove row from DOM
+ 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
23 javascript/TableListField.js
@@ -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) {
- // remove row from DOM
- obj.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);
- }
- }
- );
+ jQuery(row).fadeOut('fast', function() {
+ // remove row from DOM
+ 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
});

0 comments on commit 98f5606

Please sign in to comment.