Author: sevein
Date: Wed Oct 14 19:39:54 2009
New Revision: 3749
Log:
New rows appear with jQuery.show effect now.
Modified:
trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
trunk/web/js/multiRow.js
Modified: trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
Wed Oct 14 17:55:37 2009 (r3748)
+++ trunk/apps/qubit/modules/informationobject/templates/editDcSuccess.php
Wed Oct 14 19:39:54 2009 (r3749)
@@ -73,13 +73,13 @@
<tbody>
<tr>
<td><?php echo input_tag('updateChildLevels[0][identifier]')
?></td>
- <td><div class="animateNicely">
+ <td>
<?php echo object_select_tag(new QubitInformationObject,
'getLevelOfDescriptionId', array(
'include_blank' => true,
'name' => 'updateChildLevels[0][levelOfDescription]',
'related_class' => 'QubitTerm',
'peer_method' => 'getLevelsOfDescription')) ?>
- </div></td>
+ </td>
<td><?php echo input_tag('updateChildLevels[0][title]') ?></td>
</tr>
</tbody>
Modified:
trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
Wed Oct 14 17:55:37 2009 (r3748)
+++ trunk/apps/qubit/modules/informationobject/templates/editIsadSuccess.php
Wed Oct 14 19:39:54 2009 (r3749)
@@ -98,13 +98,13 @@
<tbody>
<tr>
<td><?php echo input_tag('updateChildLevels[0][identifier]')
?></td>
- <td><div class="animateNicely">
+ <td>
<?php echo object_select_tag(new QubitInformationObject,
'getLevelOfDescriptionId', array(
'include_blank' => true,
'name' => 'updateChildLevels[0][levelOfDescription]',
'related_class' => 'QubitTerm',
'peer_method' => 'getLevelsOfDescription')) ?>
- </div></td>
+ </td>
<td><?php echo input_tag('updateChildLevels[0][title]') ?></td>
</tr>
</tbody>
Modified:
trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
Wed Oct 14 17:55:37 2009 (r3748)
+++ trunk/apps/qubit/modules/informationobject/templates/editModsSuccess.php
Wed Oct 14 19:39:54 2009 (r3749)
@@ -74,13 +74,13 @@
<tbody>
<tr>
<td><?php echo input_tag('updateChildLevels[0][identifier]')
?></td>
- <td><div class="animateNicely">
+ <td>
<?php echo object_select_tag(new QubitInformationObject,
'getLevelOfDescriptionId', array(
'include_blank' => true,
'name' => 'updateChildLevels[0][levelOfDescription]',
'related_class' => 'QubitTerm',
'peer_method' => 'getLevelsOfDescription')) ?>
- </div></td>
+ </td>
<td><?php echo input_tag('updateChildLevels[0][title]') ?></td>
</tr>
</tbody>
Modified:
trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
==============================================================================
--- trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
Wed Oct 14 17:55:37 2009 (r3748)
+++ trunk/apps/qubit/modules/informationobject/templates/editRadSuccess.php
Wed Oct 14 19:39:54 2009 (r3749)
@@ -69,13 +69,13 @@
<tbody>
<tr>
<td><?php echo input_tag('updateChildLevels[0][identifier]')
?></td>
- <td><div class="animateNicely">
+ <td>
<?php echo object_select_tag(new QubitInformationObject,
'getLevelOfDescriptionId', array(
'include_blank' => true,
'name' => 'updateChildLevels[0][levelOfDescription]',
'related_class' => 'QubitTerm',
'peer_method' => 'getLevelsOfDescription')) ?>
- </div></td>
+ </td>
<td><?php echo input_tag('updateChildLevels[0][title]') ?></td>
</tr>
</tbody>
Modified: trunk/web/js/multiRow.js
==============================================================================
--- trunk/web/js/multiRow.js Wed Oct 14 17:55:37 2009 (r3748)
+++ trunk/web/js/multiRow.js Wed Oct 14 19:39:54 2009 (r3749)
@@ -4,28 +4,47 @@
var lastRow = table.find('tbody tr:last');
var newRow = lastRow.clone();
+ // Get the last row number (e.g.: foo[0][bar])
var lastRowNumber = parseInt(lastRow.find("select,
input").filter(":first").attr("name").match(/\d/).shift());
- // Input content is removed
- newRow.find('input, select').each(function(i)
+ // Iterate over each input and select elements
+ newRow.find('input, select').each(function(i) {
+ // Input values are removed
+ if ($(this).is('input'))
{
- if ($(this).is('input'))
- {
- $(this).val('');
- }
- else if ($(this).is('select'))
- {
- var oldSelect = lastRow.find('input, select').eq(i);
- var selectedIndex = oldSelect[0].selectedIndex;
+ $(this).val('');
+ }
+ // Select index is preserved
+ else if ($(this).is('select'))
+ {
+ var oldSelect = lastRow.find('input, select').eq(i);
+ var selectedIndex = oldSelect[0].selectedIndex;
- $(this)[0].selectedIndex = selectedIndex;
- }
+ $(this)[0].selectedIndex = selectedIndex;
+ }
- var newName = $(this).attr('name').replace(/\[\d\]/, '[' +
(lastRowNumber + 1) + ']');
- $(this).attr('name', newName);
- });
+ // Increment row number
+ var newName = $(this).attr('name').replace(/\[\d\]/, '[' + (lastRowNumber
+ 1) + ']');
+ $(this).attr('name', newName);
+ });
+
+ // Iterate over each cell
+ newRow.find('td').each(function(i) {
+ // Wrap cell with div animateNicely for jQuery.show effect
+ if (0 == $(this).find('div.animateNicely').length)
+ {
+ $(this).wrapInner('<div class="animateNicely"></div>');
+ }
+ // Hide the div
+ $(this).children().hide();
+ });
+
+ // Append the row to tbody
table.children('tbody').append(newRow);
+
+ // Show effect
+ table.find('tbody tr:last div.animateNicely').show('normal');
}
/**
@@ -34,6 +53,7 @@
Drupal.behaviors.multiRow = {
attach: function (context)
{
+ // Add tfoot for adding new rows button
$('table.multiRow').each(function () {
var tfoot = '<tfoot>';
tfoot += '<tr>';
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---