Skip to content

Commit

Permalink
Merge pull request #11950 from mattwire/cust_data_tpl_extract
Browse files Browse the repository at this point in the history
Extract custom data edit template code to shared template
  • Loading branch information
eileenmcnaughton authored Apr 5, 2018
2 parents 56f8c5a + 44a8e64 commit da0c485
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
18 changes: 5 additions & 13 deletions templates/CRM/Contribute/Form/Contribution.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -345,25 +345,17 @@
<div id="customData" class="crm-contribution-form-block-customData"></div>
{/if}

{*include custom data js file*}
{include file="CRM/common/customData.tpl"}
{include file="CRM/Custom/Form/Edit.tpl"}

{literal}
<script type="text/javascript">
CRM.$(function($) {
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}
CRM.buildCustomData( '{$customDataType}' );
{if $customDataSubType}
CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
{/if}

{if $buildPriceSet}{literal}buildAmount( );{/literal}{/if}
{if $buildPriceSet}{literal}buildAmount();{/literal}{/if}
{literal}
});

// bind first click of accordion header to load crm-accordion-body with snippet
// everything else taken care of by cj().crm-accordions()
CRM.$(function($) {
cj('#adjust-option-type').hide();
cj('.crm-ajax-accordion .crm-accordion-header').one('click', function() {
loadPanes(cj(this).attr('id'));
Expand Down
16 changes: 16 additions & 0 deletions templates/CRM/Custom/Form/Edit.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{* Edit custom data on Edit entity forms *}
{* Requires <div id="customData"></div> on the form *}
{*include custom data js file*}
{include file="CRM/common/customData.tpl"}
{literal}
<script type="text/javascript">
CRM.$(function($) {
{/literal}
CRM.buildCustomData( '{$customDataType}' );
{if $customDataSubType}
CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
{/if}
{literal}
});
</script>
{/literal}

0 comments on commit da0c485

Please sign in to comment.