Relationship permissions: standardize all permission icons into template
authorAndrew Hunt <andrew@aghstrategies.com>
Fri, 20 Jul 2018 20:05:54 +0000 (16:05 -0400)
committerAndrew Hunt <andrew@aghstrategies.com>
Fri, 20 Jul 2018 20:05:54 +0000 (16:05 -0400)
templates/CRM/Contact/Form/Relationship.tpl
templates/CRM/Contact/Page/View/Relationship.tpl
templates/CRM/Contact/Page/View/RelationshipPerm.tpl

index cfc33721af7d871dee99f85b1bb6018557d5e1fc..ad0efe0c0a8f8c6b72477019f213e11a8e47a577 100644 (file)
                 {if $row.is_permission_a_b}
                   <div>
                   {if $row.rtype EQ 'a_b' AND $is_contact_id_a}
-                    {if $row.is_permission_a_b == 1}
-                      {ts 1=$displayName 2=$row.display_name}<strong>%1</strong> can view and update information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=1 permDisplayName=$displayName otherDisplayName=$row.display_name}
-                    {else}
-                      {ts 1=$displayName 2=$row.display_name}<strong>%1</strong> can view information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=2 permDisplayName=$displayName otherDisplayName=$row.display_name}
-                    {/if}
+                    {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=$row.is_permission_a_b permDisplayName=$displayName otherDisplayName=$row.display_name displayText=true}
                   {else}
-                    {if $row.is_permission_a_b == 1}
-                      {ts 1=$row.display_name 2=$displayName}<strong>%1</strong> can view and update information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=1 otherDisplayName=$displayName permDisplayName=$row.display_name}
-                    {else}
-                      {ts 1=$row.display_name 2=$displayName}<strong>%1</strong> can view information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=2 otherDisplayName=$displayName permDisplayName=$row.display_name}
-                    {/if}
+                    {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=$row.is_permission_a_b otherDisplayName=$displayName permDisplayName=$row.display_name displayText=true}
                   {/if}
                   </div>
                 {/if}
                 {if $row.is_permission_b_a}
                   <div>
                   {if $row.rtype EQ 'a_b' AND $is_contact_id_a}
-                    {if $row.is_permission_b_a == 1}
-                      {ts 1=$row.display_name 2=$displayName}<strong>%1</strong> can view and update information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=1 otherDisplayName=$displayName permDisplayName=$row.display_name}
-                    {else}
-                      {ts 1=$row.display_name 2=$displayName}<strong>%1</strong> can view information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=2 otherDisplayName=$displayName permDisplayName=$row.display_name}
-                    {/if}
+                    {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=$row.is_permission_b_a otherDisplayName=$displayName permDisplayName=$row.display_name displayText=true}
                   {else}
-                    {if $row.is_permission_b_a == 1}
-                      {ts 1=$displayName 2=$row.display_name}<strong>%1</strong> can view and update information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=1 permDisplayName=$displayName otherDisplayName=$row.display_name}
-                    {else}
-                      {ts 1=$displayName 2=$row.display_name}<strong>%1</strong> can view information about <strong>%2</strong>{/ts} {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=2 permDisplayName=$displayName otherDisplayName=$row.display_name}
-                    {/if}
+                    {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=$row.is_permission_b_a permDisplayName=$displayName otherDisplayName=$row.display_name displayText=true}
                   {/if}
                   </div>
                 {/if}
index 1624e9d86994308fe40c8795cd21f61c8bddc468..46e1735e236430a48fb3b45100609feb59aab530 100644 (file)
     <h3>{ts}Current Relationships{/ts}</h3>
     {include file="CRM/Contact/Page/View/RelationshipSelector.tpl" context="current"}
     <div id="permission-legend" class="crm-content-block">
-      <span class="label">Permissioned Relationships: </span>&nbsp;
-      <i class="crm-i fa-eye"></i>
-      {ts}This contact can be viewed by the other.{/ts}&nbsp;
-      <i class="crm-i fa-asterisk"></i>
-      {ts}This contact can be viewed and updated by the other.{/ts}
+      <span class="label">Permissioned Relationships: </span>
+      {include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=1 afterText=true}
     </div>
 
     <div class="spacer"></div>
index 82529f22ecabc6c9abec5c26a2feeb66d5481137..e78ca39a50915f199944ae3f2551ec46635b6cc4 100644 (file)
 *}
 {* Partial for displaying permissions associated with a relationship *}
 
+{if $displayText}
 {if $permType eq 1}
-{include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=2}
+{ts 1=$permDisplayName 2=$otherDisplayName}<strong>%1</strong> can view and update information about <strong>%2</strong>.{/ts}
+{else}
+{ts 1=$permDisplayName 2=$otherDisplayName}<strong>%1</strong> can view information about <strong>%2</strong>.{/ts}
+{/if}
+{/if}
+
+{if $permType eq 1}
+{include file="CRM/Contact/Page/View/RelationshipPerm.tpl" permType=2 displayText=false}
 {/if}
 
+{if $permDisplayName and $otherDisplayName}
 {capture assign="permText"}
 {if $permType eq 1}
-{ts 1=$permDisplayName 2=$otherDisplayName}%2 can be edited by %1{/ts}
+{ts 1=$permDisplayName 2=$otherDisplayName}%2 can be edited by %1.{/ts}
 {else}
-{ts 1=$permDisplayName 2=$otherDisplayName}%2 can be viewed by %1{/ts}
+{ts 1=$permDisplayName 2=$otherDisplayName}%2 can be viewed by %1.{/ts}
 {/if}
 {/capture}
+{/if}
 
 <span class="fa-stack" title="{$permText}">
   <i class="crm-i fa-square fa-stack-2x {if $permType eq 1}crm-i-blue{else}crm-i-green{/if}"></i>
   <i class="crm-i {if $permType eq 1}fa-pencil{else}fa-eye{/if} fa-inverse fa-stack-1x"></i>
 </span>
+
+{if $afterText}
+{if $permType eq 1}
+{ts}This contact can be edited by the other.{/ts}
+{else}
+{ts}This contact can be viewed by the other.{/ts}
+{/if}
+{/if}