Add icons to contact summary tabs
authorColeman Watts <coleman@civicrm.org>
Fri, 26 Oct 2018 14:08:20 +0000 (10:08 -0400)
committerColeman Watts <coleman@civicrm.org>
Mon, 29 Oct 2018 20:10:40 +0000 (16:10 -0400)
12 files changed:
CRM/Campaign/Info.php
CRM/Case/Info.php
CRM/Contact/Page/View/Summary.php
CRM/Contribute/Info.php
CRM/Core/Component/Info.php
CRM/Event/Info.php
CRM/Grant/Info.php
CRM/Mailing/Info.php
CRM/Member/Info.php
CRM/Pledge/Info.php
CRM/Report/Info.php
templates/CRM/Contact/Page/View/Summary.tpl

index 85f5761664348973570efe99af0582757a7fcc3f..cd2d38d417b3eadfd5999e16b432c9643338137f 100644 (file)
@@ -130,6 +130,14 @@ class CRM_Campaign_Info extends CRM_Core_Component_Info {
     return NULL;
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-star-o';
+  }
+
   /**
    * @inheritDoc
    * @return null
index 259a53091137185618dbfc842c8621d463913b95..9ffe50d5cacd77723e5da6475f508c4b81218c61 100644 (file)
@@ -176,6 +176,14 @@ class CRM_Case_Info extends CRM_Core_Component_Info {
     );
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-folder-open-o';
+  }
+
   /**
    * @inheritDoc
    * @return array
index a881bbc5b63dd0d61e9753284efc06a4f166ca02..f6df10137b71f57fc23d9fd1725eff58f54f53a1 100644 (file)
@@ -316,40 +316,47 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
         'url' => '#contact-summary',
         'title' => ts('Summary'),
         'weight' => 0,
+        'icon' => 'crm-i fa-address-card-o'
       ],
       [
         'id' => 'activity',
         'title' => ts('Activities'),
         'class' => 'livePage',
         'weight' => 70,
+        'icon' => 'crm-i fa-tasks',
       ],
       [
         'id' => 'rel',
         'title' => ts('Relationships'),
         'class' => 'livePage',
         'weight' => 80,
+        'icon' => 'crm-i fa-handshake-o',
       ],
       [
         'id' => 'group',
         'title' => ts('Groups'),
         'class' => 'ajaxForm',
         'weight' => 90,
+        'icon' => 'crm-i fa-users',
       ],
       [
         'id' => 'note',
         'title' => ts('Notes'),
         'class' => 'livePage',
         'weight' => 100,
+        'icon' => 'crm-i fa-sticky-note-o',
       ],
       [
         'id' => 'tag',
         'title' => ts('Tags'),
         'weight' => 110,
+        'icon' => 'crm-i fa-tags',
       ],
       [
         'id' => 'log',
         'title' => ts('Change Log'),
         'weight' => 120,
+        'icon' => 'crm-i fa-history',
       ],
     ];
   }
@@ -391,6 +398,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
           'weight' => $elem['weight'],
           'count' => CRM_Contact_BAO_Contact::getCountComponent($u, $this->_contactId),
           'class' => 'livePage',
+          'icon' => $component->getIcon(),
         ];
       }
     }
@@ -431,6 +439,7 @@ class CRM_Contact_Page_View_Summary extends CRM_Contact_Page_View {
         'count' => CRM_Contact_BAO_Contact::getCountComponent($id, $this->_contactId, $group['table_name']),
         'hideCount' => !$group['is_multiple'],
         'class' => 'livePage',
+        'icon' => 'crm-i fa-gear',
       ];
       $weight += 10;
     }
index 41f03e46b42c74517a3b2858339d40d9f00f8cfd..4fa48a9c981f4cc7d282df0425bf70379e1d3891 100644 (file)
@@ -164,6 +164,14 @@ class CRM_Contribute_Info extends CRM_Core_Component_Info {
     );
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-credit-card';
+  }
+
   /**
    * @inheritDoc
    * Provides information about advanced search pane
index 00c228ef64e49d3a5581eff6836bcb406c2cbf9f..76a390c90b6e045f038a392938a68b4028dfd7dd 100644 (file)
@@ -198,6 +198,15 @@ abstract class CRM_Core_Component_Info {
    */
   abstract public function registerTab();
 
+  /**
+   * Get icon font class representing this component.
+   *
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-puzzle-piece';
+  }
+
   /**
    * Provides information about advanced search pane
    * offered by this component.
index afd957c157f1c33a2198f9debfc0944b8350dd6d..5d578b94ee9dd47c6dae120111574b82d3b16532 100644 (file)
@@ -143,6 +143,14 @@ class CRM_Event_Info extends CRM_Core_Component_Info {
     );
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-calendar';
+  }
+
   /**
    * @inheritDoc
    * @return array
index 1bf6045ff2beee0733711073f2531dc509d7f91d..cfd14fd40f7f10b7ed1f1387260a727c84a91b6b 100644 (file)
@@ -121,6 +121,14 @@ class CRM_Grant_Info extends CRM_Core_Component_Info {
     );
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-money';
+  }
+
   /**
    * @inheritDoc
    * @return array
index 0a2d8cca868ed38aba99b4286b01b23c5fcefa07..f8a1fa6726bc47c09ab2630a2a4f62dbab701f3f 100644 (file)
@@ -276,6 +276,14 @@ class CRM_Mailing_Info extends CRM_Core_Component_Info {
     );
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-envelope-o';
+  }
+
   /**
    * @inheritDoc
    * @return array
index 504c51d0a6f087371ca5975e0cf056ecb22e9bee..4c5674a9abbcbd02412f4b364ce82bd8d14755d4 100644 (file)
@@ -150,6 +150,14 @@ class CRM_Member_Info extends CRM_Core_Component_Info {
     );
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-id-badge';
+  }
+
   /**
    * @inheritDoc
    * Provides information about advanced search pane
index 475b85fe27bd569cc5965dfb40f2656fafb38995..fbc603711d6e73f48b56a7d023ddff0338f1f0f4 100644 (file)
@@ -136,6 +136,14 @@ class CRM_Pledge_Info extends CRM_Core_Component_Info {
     );
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-paper-plane';
+  }
+
   /**
    * @inheritDoc
    * Provides information about advanced search pane
index 8d8c429a5deb3c57505cbaca3764f771bc772c75..054090303ba409f85f677498b8804dcb5f2fd225 100644 (file)
@@ -164,6 +164,14 @@ class CRM_Report_Info extends CRM_Core_Component_Info {
     return NULL;
   }
 
+  /**
+   * @inheritDoc
+   * @return string
+   */
+  public function getIcon() {
+    return 'crm-i fa-table';
+  }
+
   /**
    * @inheritDoc
    * Provides information about advanced search pane
index 52fb8d38ff2b109fc45f666c5e587750b08a16aa..e3ed5d3e4260cbac324c7d42299a613c1a8a5c02 100644 (file)
         {foreach from=$allTabs key=tabName item=tabValue}
           <li id="tab_{$tabValue.id}" class="crm-tab-button ui-corner-all crm-count-{$tabValue.count}{if isset($tabValue.class)} {$tabValue.class}{/if}">
             <a href="{$tabValue.url}" title="{$tabValue.title|escape}">
+              <i class="{if $tabValue.icon}{$tabValue.icon}{else}crm-i fa-puzzle-piece{/if}"></i>
               {$tabValue.title}
               {if empty($tabValue.hideCount)}<em>{$tabValue.count}</em>{/if}
             </a>