From b22f0cadc6067328187515106e91f2b5543e9146 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sat, 8 Mar 2014 11:23:29 -0500 Subject: [PATCH] CRM-10693 - Trigger crmLoad event when loading content --- templates/CRM/Campaign/Form/Gotv.tpl | 2 +- templates/CRM/Campaign/Form/Search/Campaign.tpl | 2 +- templates/CRM/Campaign/Form/Search/Petition.tpl | 2 +- templates/CRM/Campaign/Form/Search/Survey.tpl | 2 +- templates/CRM/Contribute/Form/AdditionalPayment.tpl | 2 +- templates/CRM/Contribute/Form/Contribution.tpl | 4 ++-- templates/CRM/Contribute/Page/PaymentInfo.tpl | 4 ++-- .../CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl | 2 +- templates/CRM/Event/Form/Participant.tpl | 4 ++-- templates/CRM/Group/Form/Search.tpl | 1 + templates/CRM/Pledge/Form/Pledge.tpl | 2 +- templates/CRM/Pledge/Form/Selector.tpl | 2 +- templates/CRM/Pledge/Page/UserDashboard.tpl | 2 +- templates/CRM/Report/Form/Case/Detail.tpl | 2 +- templates/CRM/common/paymentBlock.tpl | 2 +- 15 files changed, 18 insertions(+), 17 deletions(-) diff --git a/templates/CRM/Campaign/Form/Gotv.tpl b/templates/CRM/Campaign/Form/Gotv.tpl index b5c9555298..8c66b5d200 100755 --- a/templates/CRM/Campaign/Form/Gotv.tpl +++ b/templates/CRM/Campaign/Form/Gotv.tpl @@ -107,7 +107,7 @@ function searchVoters( qfKey ) if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey; cj.get( dataUrl, null, function( voterList ) { - cj( '#voterList' ).html( voterList ); + cj( '#voterList' ).html( voterList ).trigger('crmLoad'); //collapse the search form. var searchFormName = '#search_form_' + {/literal}'{$searchVoterFor}'{literal}; diff --git a/templates/CRM/Campaign/Form/Search/Campaign.tpl b/templates/CRM/Campaign/Form/Search/Campaign.tpl index 2e7ab3157d..407abd02fe 100755 --- a/templates/CRM/Campaign/Form/Search/Campaign.tpl +++ b/templates/CRM/Campaign/Form/Search/Campaign.tpl @@ -166,7 +166,7 @@ } cj.get(dataUrl, null, function (campaignList) { - cj('#campaignList').html(campaignList); + cj('#campaignList').html(campaignList).trigger('crmLoad'); //collapse the search form. var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal}; diff --git a/templates/CRM/Campaign/Form/Search/Petition.tpl b/templates/CRM/Campaign/Form/Search/Petition.tpl index 19acfbfee7..98cb12785c 100755 --- a/templates/CRM/Campaign/Form/Search/Petition.tpl +++ b/templates/CRM/Campaign/Form/Search/Petition.tpl @@ -147,7 +147,7 @@ function searchPetitions( qfKey ) if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey; cj.get( dataUrl, null, function( petitionList ) { - cj( '#petitionList' ).html( petitionList ); + cj( '#petitionList' ).html( petitionList ).trigger('crmLoad'); //collapse the search form. var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal}; diff --git a/templates/CRM/Campaign/Form/Search/Survey.tpl b/templates/CRM/Campaign/Form/Search/Survey.tpl index 98c8546765..2be552e15c 100755 --- a/templates/CRM/Campaign/Form/Search/Survey.tpl +++ b/templates/CRM/Campaign/Form/Search/Survey.tpl @@ -155,7 +155,7 @@ function searchSurveys( qfKey ) if ( qfKey ) dataUrl = dataUrl + '&qfKey=' + qfKey; cj.get( dataUrl, null, function( surveyList ) { - cj( '#surveyList' ).html( surveyList ); + cj( '#surveyList' ).html( surveyList ).trigger('crmLoad'); //collapse the search form. var searchFormName = '#search_form_' + {/literal}'{$searchFor}'{literal}; diff --git a/templates/CRM/Contribute/Form/AdditionalPayment.tpl b/templates/CRM/Contribute/Form/AdditionalPayment.tpl index 442f92a01a..20ff74c49d 100644 --- a/templates/CRM/Contribute/Form/AdditionalPayment.tpl +++ b/templates/CRM/Contribute/Form/AdditionalPayment.tpl @@ -258,7 +258,7 @@ cj('div.'+id).html(loading); cj.ajax({ url : url, - success: function(data) { cj('div.'+id).html(data); } + success: function(data) { cj('div.'+id).html(data).trigger('crmLoad'); } }); } } diff --git a/templates/CRM/Contribute/Form/Contribution.tpl b/templates/CRM/Contribute/Form/Contribution.tpl index 2db480deac..92cd19f336 100644 --- a/templates/CRM/Contribute/Form/Contribution.tpl +++ b/templates/CRM/Contribute/Form/Contribution.tpl @@ -385,7 +385,7 @@ cj('div.'+id).html(loading); cj.ajax({ url : url, - success: function(data) { cj('div.'+id).html(data); } + success: function(data) { cj('div.'+id).html(data).trigger('crmLoad'); } }); } } @@ -583,7 +583,7 @@ function buildAmount( priceSetId ) { async: false }).responseText; - cj( fname ).show( ).html( response ); + cj( fname ).show( ).html( response ).trigger('crmLoad'); // freeze total amount text field. cj( "#total_amount").val(''); diff --git a/templates/CRM/Contribute/Page/PaymentInfo.tpl b/templates/CRM/Contribute/Page/PaymentInfo.tpl index c388efeab1..02e479cf83 100644 --- a/templates/CRM/Contribute/Page/PaymentInfo.tpl +++ b/templates/CRM/Contribute/Page/PaymentInfo.tpl @@ -32,7 +32,7 @@ cj(function($){ url: dataUrl, async: false, success: function(html) { - cj("#payment-info").html(html); + cj("#payment-info").html(html).trigger('crmLoad'); } }); @@ -68,4 +68,4 @@ cj(function($){ {/if}
{ts}{$paymentButtonName}{/ts}
{/if} -{/if} \ No newline at end of file +{/if} diff --git a/templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl b/templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl index f01f369580..7812330523 100644 --- a/templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl +++ b/templates/CRM/Event/Cart/Form/Checkout/ParticipantsAndPrices.tpl @@ -65,7 +65,7 @@ function add_participant( cart_id, event_id ) { // FIXME: this get should be a post according to restful standards cj.get(CRM.url("civicrm/ajax/event/add_participant_to_cart", {cart_id: cart_id, event_id: event_id}), function(data) { - cj('#event_' + event_id + '_participants').append(data); + cj('#event_' + event_id + '_participants').append(data).trigger('crmLoad'); } ); } diff --git a/templates/CRM/Event/Form/Participant.tpl b/templates/CRM/Event/Form/Participant.tpl index 1df9af497d..8f07a89c03 100644 --- a/templates/CRM/Event/Form/Participant.tpl +++ b/templates/CRM/Event/Form/Participant.tpl @@ -423,7 +423,7 @@ async: false, global: false, success: function ( html ) { - $("#feeBlock").html( html ); + $("#feeBlock").html( html ).trigger('crmLoad'); } }); @@ -541,7 +541,7 @@ if ( subType != 'null' ) { if ( document.getElementById(roleid).checked == true ) { var response_text = '
'+response+'
'; - $( fname ).append(response_text); + $( fname ).append(response_text).trigger('crmLoad'); } else { $('#'+subType+'_chk').remove(); diff --git a/templates/CRM/Group/Form/Search.tpl b/templates/CRM/Group/Form/Search.tpl index bf746c2d76..ea9b6edfe7 100644 --- a/templates/CRM/Group/Form/Search.tpl +++ b/templates/CRM/Group/Form/Search.tpl @@ -312,6 +312,7 @@ function showChildren( parent_id, showOrgInfo, group_id, levelClass) { appendHTML += ""; }); cj( rowID ).after( appendHTML ); + cj( rowID ).next().trigger('crmLoad'); cj('.crm-editable').crmEditable(); } } ); diff --git a/templates/CRM/Pledge/Form/Pledge.tpl b/templates/CRM/Pledge/Form/Pledge.tpl index c9fce0eee9..93142414ae 100644 --- a/templates/CRM/Pledge/Form/Pledge.tpl +++ b/templates/CRM/Pledge/Form/Pledge.tpl @@ -174,7 +174,7 @@ function loadPanes( id ) { cj('div.'+id).html(loading); cj.ajax({ url : url, - success: function(data) { cj('div.'+id).html(data); } + success: function(data) { cj('div.'+id).html(data).trigger('crmLoad'); } }); } } diff --git a/templates/CRM/Pledge/Form/Selector.tpl b/templates/CRM/Pledge/Form/Selector.tpl index 6d981d279f..f98093dc12 100644 --- a/templates/CRM/Pledge/Form/Selector.tpl +++ b/templates/CRM/Pledge/Form/Selector.tpl @@ -123,7 +123,7 @@ dataType: "html", timeout : 5000, //Time in milliseconds success : function( data ){ - cj( '#paymentDetails' + pledgeId ).html( data ); + cj( '#paymentDetails' + pledgeId ).html( data ).trigger('crmLoad'); }, error : function( XMLHttpRequest, textStatus, errorThrown ) { console.error( 'Error: '+ textStatus ); diff --git a/templates/CRM/Pledge/Page/UserDashboard.tpl b/templates/CRM/Pledge/Page/UserDashboard.tpl index 846111e7f5..4cafdcc951 100644 --- a/templates/CRM/Pledge/Page/UserDashboard.tpl +++ b/templates/CRM/Pledge/Page/UserDashboard.tpl @@ -121,7 +121,7 @@ function buildPaymentDetails( pledgeId, contactId ) dataType: "html", timeout : 5000, //Time in milliseconds success : function( data ){ - cj( '#paymentDetails' + pledgeId ).html( data ); + cj( '#paymentDetails' + pledgeId ).html( data ).trigger('crmLoad'); }, error : function( XMLHttpRequest, textStatus, errorThrown ) { console.error( 'Error: '+ textStatus ); diff --git a/templates/CRM/Report/Form/Case/Detail.tpl b/templates/CRM/Report/Form/Case/Detail.tpl index e51dd0fa64..dcf9bf3ecc 100644 --- a/templates/CRM/Report/Form/Case/Detail.tpl +++ b/templates/CRM/Report/Form/Case/Detail.tpl @@ -308,7 +308,7 @@ function viewCase( caseId ,contactId ) { dataType: "html", timeout : 5000, //Time in milliseconds success : function( data ){ - cj( "#casedetails").html( data ); + cj( "#casedetails").html( data ).trigger('crmLoad'); }, }); }, diff --git a/templates/CRM/common/paymentBlock.tpl b/templates/CRM/common/paymentBlock.tpl index 68586b7bca..3cb145b150 100644 --- a/templates/CRM/common/paymentBlock.tpl +++ b/templates/CRM/common/paymentBlock.tpl @@ -55,7 +55,7 @@ function buildPaymentBlock( type ) { async: false }).responseText; - cj('#billing-payment-block').html(response).trigger('crmFormLoad'); + cj('#billing-payment-block').html(response).trigger('crmLoad').trigger('crmFormLoad'); } cj( function() { -- 2.25.1