Author: david
Date: 2008-12-01 17:00:50 -0800 (Mon, 01 Dec 2008)
New Revision: 1650

Modified:
   trunk/qubit/web/js/multiDelete.js
Log:
Do some tweaks to multiDelete.js:
- Remove unnecessary "this" parameter from multiDelete() function,
- Only hide *visible* divs (i.e. not in collapsed sections) - hiding divs that 
were already hidden was breaking the hide animation

Modified: trunk/qubit/web/js/multiDelete.js
===================================================================
--- trunk/qubit/web/js/multiDelete.js   2008-12-02 00:38:07 UTC (rev 1649)
+++ trunk/qubit/web/js/multiDelete.js   2008-12-02 01:00:50 UTC (rev 1650)
@@ -5,18 +5,17 @@
  * @param object thisElement dom <select> element to operate on
  * @return void
  */
-function multiDelete(obj, thisName)
+function multiDelete(elementName)
 {
   // Hide element
-  var thisElement = $(obj);
-  var relatedObjName = thisName.replace(/\w+\[(\d+)\]/, 'related_obj_$1');
+  var relatedObjName = elementName.replace(/\w+\[(\d+)\]/, 'related_obj_$1');
   var parentRows = $('tr.'+relatedObjName);
-  parentRows.find('div').hide('normal', function() {
+  parentRows.find('div:visible').hide('normal', function() {
     parentRows.remove();
   });
 
   // Append hidden field to delete element on form submit
-  $('form#editForm').append('<input type="hidden" name="'+thisName+'" 
value="delete">');
+  $('form#editForm').append('<input type="hidden" name="'+elementName+'" 
value="delete">');
 }
 
 /**
@@ -25,8 +24,8 @@
 Drupal.behaviors.replaceMultiDelete = function (context)
 {
   $('input[type="checkbox"].multiDelete').each(function () {
-    var thisName = $(this).attr('name');
-    $(this).replaceWith('<button class="delete-small" 
onclick="multiDelete(this, \''+thisName+'\'); return false;" />');
+    var elementName = $(this).attr('name');
+    $(this).replaceWith('<button class="delete-small" 
onclick="multiDelete(\''+elementName+'\'); return false;" />');
   });
 
   // Remove delete icons in table headers


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to