| 1 | // http://civicrm.org/licensing |
| 2 | CRM.$(function($) { |
| 3 | $('body') |
| 4 | .off('.crmExpandRow') |
| 5 | .on('click.crmExpandRow', 'a.crm-expand-row', function(e) { |
| 6 | var $row = $(this).closest('tr'); |
| 7 | if ($(this).hasClass('expanded')) { |
| 8 | $row.next('.crm-child-row').children('td').children('div.crm-ajax-container') |
| 9 | .slideUp('fast', function() {$(this).closest('.crm-child-row').remove();}); |
| 10 | } else { |
| 11 | var count = $('td', $row).length, |
| 12 | $newRow = $('<tr class="crm-child-row"><td colspan="' + count + '"><div></div></td></tr>') |
| 13 | .insertAfter($row); |
| 14 | CRM.loadPage(this.href, {target: $('div', $newRow).animate({minHeight: '3em'}, 'fast')}); |
| 15 | } |
| 16 | $(this).toggleClass('expanded'); |
| 17 | e.preventDefault(); |
| 18 | }); |
| 19 | }); |