Use PrematureExit exception instead of weird hack in tests
[civicrm-core.git] / js / crm.expandRow.js
CommitLineData
3154780c
CW
1// http://civicrm.org/licensing
2CRM.$(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')) {
18face18
CW
8 $row.next('.crm-child-row').children('td').children('div.crm-ajax-container')
9 .slideUp('fast', function() {$(this).closest('.crm-child-row').remove();});
3154780c
CW
10 } else {
11 var count = $('td', $row).length,
18face18 12 $newRow = $('<tr class="crm-child-row"><td colspan="' + count + '"><div></div></td></tr>')
3154780c 13 .insertAfter($row);
18face18 14 CRM.loadPage(this.href, {target: $('div', $newRow).animate({minHeight: '3em'}, 'fast')});
3154780c
CW
15 }
16 $(this).toggleClass('expanded');
17 e.preventDefault();
18 });
19});