From 0ebeb01abfa4f5e369d3f0c573c3c22179676286 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 23 Mar 2021 10:44:14 -0400 Subject: [PATCH] Reorganize contact summary template to support non-ajax tabs There was some non-functional (due to a typo) code in TabHeader.tpl to allow tabs to load from a .tpl instead of ajax. This fixes that typo and copies the funcionality into the contact summary tabs as well. The functionality is demonstrated here by moving the main tab into a sub-tempate. --- CRM/Contact/Page/View/Summary.php | 2 +- .../CRM/Contact/Page/View/Summary-tab.tpl | 156 +++++++++++++++++ templates/CRM/Contact/Page/View/Summary.tpl | 162 ++---------------- templates/CRM/common/TabHeader.tpl | 2 +- 4 files changed, 168 insertions(+), 154 deletions(-) create mode 100644 templates/CRM/Contact/Page/View/Summary-tab.tpl diff --git a/CRM/Contact/Page/View/Summary.php b/CRM/Contact/Page/View/Summary.php index e173a8df54..dc4ddf1e41 100644 --- a/CRM/Contact/Page/View/Summary.php +++ b/CRM/Contact/Page/View/Summary.php @@ -297,7 +297,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View { return [ [ 'id' => 'summary', - 'url' => '#contact-summary', + 'template' => 'CRM/Contact/Page/View/Summary-tab.tpl', 'title' => ts('Summary'), 'weight' => 0, 'icon' => 'crm-i fa-address-card-o', diff --git a/templates/CRM/Contact/Page/View/Summary-tab.tpl b/templates/CRM/Contact/Page/View/Summary-tab.tpl new file mode 100644 index 0000000000..67cf851f3e --- /dev/null +++ b/templates/CRM/Contact/Page/View/Summary-tab.tpl @@ -0,0 +1,156 @@ +{* + +--------------------------------------------------------------------+ + | Copyright CiviCRM LLC. All rights reserved. | + | | + | This work is published under the GNU AGPLv3 license with some | + | permitted exceptions and without any warranty. For full license | + | and copyright information, see https://civicrm.org/licensing | + +--------------------------------------------------------------------+ +*} +{* Summary tab from Contact Summary screen *} + +{if (isset($hookContentPlacement) and ($hookContentPlacement neq 3)) or empty($hookContentPlacement)} + + {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 2} + {include file="CRM/Contact/Page/View/SummaryHook.tpl"} + {/if} + +
+
+ {crmRegion name="contact-basic-info-left"} +
+
+ {include file="CRM/Contact/Page/Inline/ContactInfo.tpl"} +
+
+ {/crmRegion} +
+
+ {crmRegion name="contact-basic-info-right"} + {if !empty($imageURL)} +
+ {include file="CRM/Contact/Page/ContactImage.tpl"} +
+ {/if} +
+
+ {include file="CRM/Contact/Page/Inline/Basic.tpl"} +
+
+ {/crmRegion} +
+
+
+
+
+ {crmRegion name="contact-details-left"} +
+ {if $showEmail} +
+ {include file="CRM/Contact/Page/Inline/Email.tpl"} +
+ {/if} + {if $showWebsite} +
+ {include file="CRM/Contact/Page/Inline/Website.tpl"} +
+ {/if} +
+ {/crmRegion} +
+ +
+ {crmRegion name="contact-details-right"} +
+ {if $showPhone} +
+ {include file="CRM/Contact/Page/Inline/Phone.tpl"} +
+ {/if} + {if $showIM} +
+ {include file="CRM/Contact/Page/Inline/IM.tpl"} +
+ {/if} + {if $showOpenID} +
+ {include file="CRM/Contact/Page/Inline/OpenID.tpl"} +
+ {/if} +
+ {/crmRegion} +
+ +
+
+ {if $showAddress} +
+ {crmRegion name="contact-addresses"} + {assign var='locationIndex' value=1} + {if $address} + {foreach from=$address item=add key=locationIndex} +
+ {include file="CRM/Contact/Page/Inline/Address.tpl"} +
+ {/foreach} + {assign var='locationIndex' value=$locationIndex+1} + {/if} + {* add new link *} + {if $permission EQ 'edit'} + {assign var='add' value=0} +
+ {include file="CRM/Contact/Page/Inline/Address.tpl"} +
+ {/if} + {/crmRegion} +
+ {/if} +
+ {if $showCommunicationPreferences} +
+ {crmRegion name="contact-comm-pref"} +
+
+ {include file="CRM/Contact/Page/Inline/CommunicationPreferences.tpl"} +
+
+ {/crmRegion} +
+ {/if} + {if $contact_type eq 'Individual' AND $showDemographics} +
+ {crmRegion name="contact-demographic"} +
+
+ {include file="CRM/Contact/Page/Inline/Demographics.tpl"} +
+
+ {/crmRegion} +
+ {/if} +
+
+
+
+ + {if $showCustomData} +
+
+
+ {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='1'} +
+
+ {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='0'} +
+ +
+
+
+ {/if} + + {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 1} + {include file="CRM/Contact/Page/View/SummaryHook.tpl"} + {/if} +{else} + {include file="CRM/Contact/Page/View/SummaryHook.tpl"} +{/if} diff --git a/templates/CRM/Contact/Page/View/Summary.tpl b/templates/CRM/Contact/Page/View/Summary.tpl index bad21b98b2..1fbd228aa2 100644 --- a/templates/CRM/Contact/Page/View/Summary.tpl +++ b/templates/CRM/Contact/Page/View/Summary.tpl @@ -107,9 +107,9 @@
-
- {if (isset($hookContentPlacement) and ($hookContentPlacement neq 3)) or empty($hookContentPlacement)} - - {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 2} - {include file="CRM/Contact/Page/View/SummaryHook.tpl"} - {/if} - -
-
- {crmRegion name="contact-basic-info-left"} -
-
- {include file="CRM/Contact/Page/Inline/ContactInfo.tpl"} -
-
- {/crmRegion} -
-
- {crmRegion name="contact-basic-info-right"} - {if !empty($imageURL)} -
- {include file="CRM/Contact/Page/ContactImage.tpl"} -
- {/if} -
-
- {include file="CRM/Contact/Page/Inline/Basic.tpl"} -
-
- {/crmRegion} -
- -
-
-
-
- {crmRegion name="contact-details-left"} -
- {if $showEmail} -
- {include file="CRM/Contact/Page/Inline/Email.tpl"} -
- {/if} - {if $showWebsite} -
- {include file="CRM/Contact/Page/Inline/Website.tpl"} -
- {/if} -
- {/crmRegion} -
- -
- {crmRegion name="contact-details-right"} -
- {if $showPhone} -
- {include file="CRM/Contact/Page/Inline/Phone.tpl"} -
- {/if} - {if $showIM} -
- {include file="CRM/Contact/Page/Inline/IM.tpl"} -
- {/if} - {if $showOpenID} -
- {include file="CRM/Contact/Page/Inline/OpenID.tpl"} -
- {/if} -
- {/crmRegion} -
- -
-
- {if $showAddress} -
- {crmRegion name="contact-addresses"} - {assign var='locationIndex' value=1} - {if $address} - {foreach from=$address item=add key=locationIndex} -
- {include file="CRM/Contact/Page/Inline/Address.tpl"} -
- {/foreach} - {assign var='locationIndex' value=$locationIndex+1} - {/if} - {* add new link *} - {if $permission EQ 'edit'} - {assign var='add' value=0} -
- {include file="CRM/Contact/Page/Inline/Address.tpl"} -
- {/if} - {/crmRegion} -
- {/if} -
- {if $showCommunicationPreferences} -
- {crmRegion name="contact-comm-pref"} -
-
- {include file="CRM/Contact/Page/Inline/CommunicationPreferences.tpl"} -
-
- {/crmRegion} -
- {/if} - {if $contact_type eq 'Individual' AND $showDemographics} -
- {crmRegion name="contact-demographic"} -
-
- {include file="CRM/Contact/Page/Inline/Demographics.tpl"} -
-
- {/crmRegion} -
- {/if} -
-
-
-
- - {if $showCustomData} -
-
-
- {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='1'} -
-
- {include file="CRM/Contact/Page/View/CustomDataView.tpl" side='0'} -
- -
-
-
- {/if} - - {if !empty($hookContent) and isset($hookContentPlacement) and $hookContentPlacement eq 1} - {include file="CRM/Contact/Page/View/SummaryHook.tpl"} - {/if} - {else} - {include file="CRM/Contact/Page/View/SummaryHook.tpl"} - {/if} -
-
+ {foreach from=$allTabs item=tabValue} + {if !empty($tabValue.template)} +
+ {include file=$tabValue.template} +
+ {/if} + {/foreach}
-
+ {/if} {* CRM-10560 *} diff --git a/templates/CRM/common/TabHeader.tpl b/templates/CRM/common/TabHeader.tpl index 1345f31f9a..c2e54d9b8a 100644 --- a/templates/CRM/common/TabHeader.tpl +++ b/templates/CRM/common/TabHeader.tpl @@ -28,7 +28,7 @@ {foreach from=$tabHeader key=tabName item=tabValue} {if !empty($tabValue.template)} -
+
{include file=$tabValue.template}
{/if} -- 2.25.1