CRM-15789 - Button cleanup
authorColeman Watts <coleman@civicrm.org>
Sun, 8 Feb 2015 17:01:48 +0000 (12:01 -0500)
committerColeman Watts <coleman@civicrm.org>
Sun, 8 Feb 2015 17:01:48 +0000 (12:01 -0500)
----------------------------------------
* CRM-15789: Add icons to submit buttons
  https://issues.civicrm.org/jira/browse/CRM-15789

CRM/Admin/Form/Setting/Smtp.php
CRM/Contact/Form/DedupeFind.php
CRM/Contact/Page/AJAX.php
CRM/Core/Smarty/plugins/block.crmButton.php
templates/CRM/Admin/Form/Setting/Smtp.tpl
templates/CRM/Contact/Form/Merge.tpl
templates/CRM/Contact/Page/DedupeFind.tpl
templates/CRM/Contact/Page/View/Email.tpl
templates/CRM/Contact/Page/View/Note.tpl
templates/CRM/Contact/Page/View/SMS.tpl

index 9655de1bd58d273b07f4bf46298ac5bf8ee33f57..592093e35f2f638310f3b29370ecd9fca2e2a8bb 100644 (file)
@@ -67,10 +67,11 @@ class CRM_Admin_Form_Setting_Smtp extends CRM_Admin_Form_Setting {
 
     $this->_testButtonName = $this->getButtonName('refresh', 'test');
 
-    $this->add('submit', $this->_testButtonName, ts('Save & Send Test Email'));
-
     $this->addFormRule(array('CRM_Admin_Form_Setting_Smtp', 'formRule'));
     parent::buildQuickForm();
+    $buttons = $this->getElement('buttons')->getElements();
+    $buttons[] = $this->createElement('submit', $this->_testButtonName, ts('Save & Send Test Email'), array('crm-icon' => 'mail-closed'));
+    $this->getElement('buttons')->setElements($buttons);
   }
 
   /**
index 587f58fa3a86e8da645e6776ee632d9741d5e8da..89bed60359320f35b9965b8439398065c952aa25 100644 (file)
@@ -72,6 +72,8 @@ class CRM_Contact_Form_DedupeFind extends CRM_Admin_Form {
         //hack to support cancel button functionality
         array(
           'type' => 'submit',
+          'class' => 'cancel',
+          'icon' => 'close',
           'name' => ts('Cancel'),
         ),
       )
index 14ae97970e16234fbcf2fd5eae0586dd9ae39651..256c1f8be921635b9e84bd7544a1f523da3e6cfe 100644 (file)
@@ -975,8 +975,8 @@ LIMIT {$offset}, {$rowCount}
           $mergeParams .= "&gid={$gid}";
         }
 
-        $searchRows[$mainId]['actions'] = CRM_Utils_System::href(ts('merge'), 'civicrm/contact/merge', $mergeParams);
-        $searchRows[$mainId]['actions'] .= "&nbsp;|&nbsp; <a id='notDuplicate' href='#' onClick=\"processDupes( {$main['srcID']}, {$main['dstID']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
+        $searchRows[$mainId]['actions'] = '<a class="action-item crm-hover-button" href="'. CRM_Utils_System::url('civicrm/contact/merge', $mergeParams) . '">' . ts('merge') . '</a>';
+        $searchRows[$mainId]['actions'] .= "<a class='action-item crm-hover-button crm-notDuplicate' href='#' onClick=\"processDupes( {$main['srcID']}, {$main['dstID']}, 'dupe-nondupe', 'dupe-listing'); return false;\">" . ts('not a duplicate') . "</a>";
       }
       else {
         $searchRows[$mainId]['actions'] = '<em>' . ts('Insufficient access rights - cannot merge') . '</em>';
@@ -1010,6 +1010,9 @@ LIMIT {$offset}, {$rowCount}
     CRM_Utils_JSON::output($paperSize);
   }
 
+  /**
+   * Used to store selected contacts across multiple pages in advanced search.
+   */
   public static function selectUnselectContacts() {
     $name = CRM_Utils_Array::value('name', $_REQUEST);
     $cacheKey = CRM_Utils_Array::value('qfKey', $_REQUEST);
index 6bc7f906cabcb8ed1890fda59dc4eebab3083f57..6ccd8e53a014028fb777572de5f7a0d1ba756ae0 100644 (file)
@@ -48,7 +48,9 @@
  */
 function smarty_block_crmButton($params, $text, &$smarty) {
   // Generate url (pass 'html' param as false to avoid double-encode by htmlAttributes)
-  $params['href'] = CRM_Utils_System::crmURL($params + array('h' => FALSE));
+  if (empty($params['href'])) {
+    $params['href'] = CRM_Utils_System::crmURL($params + array('h' => FALSE));
+  }
   // Always add class 'button' - fixme probably should be crm-button
   $params['class'] = 'button ' . CRM_Utils_Array::value('class', $params, '');
   // Any jQuery-UI icon works
index 99cbc6f8889e490b9b6e9d5d54f3b3710cf75477..b8754c5cc8abf0b93be56eb99e37402e5974c693 100644 (file)
@@ -91,8 +91,6 @@
         <div class="spacer"></div>
         <div class="crm-submit-buttons">
             {include file="CRM/common/formButtons.tpl"}
-            <span class="float-left">&nbsp;&nbsp;&nbsp;&nbsp;</span>
-            <span class="crm-button crm-button-type-next crm-button_qf_Smtp_refresh_test">{$form._qf_Smtp_refresh_test.html}</span>
         </div>
 </div>
 
               case "0":
                 $("#bySMTP").show( );
                 $("#bySendmail").hide( );
-                $("#_qf_Smtp_refresh_test").show( );
+                $("#_qf_Smtp_refresh_test").prop('disabled', false);
                 if (mailSetting == '5') {
                   alert(archiveWarning);
                 }
               case "1":
                 $("#bySMTP").hide( );
                 $("#bySendmail").show( );
-                $("#_qf_Smtp_refresh_test").show( );
+                $("#_qf_Smtp_refresh_test").prop('disabled', false);
                 if (mailSetting == '5') {
                   alert(archiveWarning);
                 }
               break;
               case "3":
                 $('.mailoption').hide();
-                $("#_qf_Smtp_refresh_test").show( );
+                $("#_qf_Smtp_refresh_test").prop('disabled', false);
                 if (mailSetting == '5') {
                   alert(archiveWarning);
                 }
               default:
                 $("#bySMTP").hide( );
                 $("#bySendmail").hide( );
-                $("#_qf_Smtp_refresh_test").hide( );
+                $("#_qf_Smtp_refresh_test").prop('disabled', true);
             }
         }
 
index a82205402f0daccdf666d3c0d73736d9bcef19c4..fad476bd13d33ae855df4a628281eabd51a2da08 100644 (file)
@@ -29,9 +29,9 @@
 </div>
 
 <div class="crm-submit-buttons">
-  {if $prev}<a href="{$prev}" class="button"><span><div class="icon ui-icon-triangle-1-w"></div> {ts}Prev{/ts}</span></a>{/if}
   {include file="CRM/common/formButtons.tpl" location="top"}
-  {if $next}<a href="{$next}" class="button"><span><div class="icon ui-icon-triangle-1-e"></div> {ts}Next{/ts}</span></a>{/if}
+  {if $prev}<a href="{$prev}" class="crm-hover-button action-item"><span class="icon ui-icon-triangle-1-w"></span> {ts}Previous{/ts}</a>{/if}
+  {if $next}<a href="{$next}" class="crm-hover-button action-item">{ts}Next{/ts} <span class="icon ui-icon-triangle-1-e"></span></a>{/if}
 </div>
 
 <div class="action-link">
@@ -42,7 +42,7 @@
 </div>
 
 <div class="action-link">
-  <a id='notDuplicate' href="#" class="action-item crm-hover-button" title={ts}Mark this pair as not a duplicate.{/ts} onClick="processDupes( {$main_cid}, {$other_cid}, 'dupe-nondupe', 'merge-contact', '{if $rgid}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=$rgid"}{/if}' );return false;">
+  <a href="#" class="action-item crm-hover-button crm-notDuplicate" title={ts}Mark this pair as not a duplicate.{/ts} onClick="processDupes( {$main_cid}, {$other_cid}, 'dupe-nondupe', 'merge-contact', '{if $rgid}{crmURL p="civicrm/contact/dedupefind" q="reset=1&action=update&rgid=$rgid"}{/if}' );return false;">
     <span class="icon ui-icon-circle-close"></span>
     {ts}Mark this pair as not a duplicate.{/ts}
   </a>
@@ -148,9 +148,7 @@ You will need to manually delete that user (click on the link to open Drupal Use
 </div>
 
 <div class="crm-submit-buttons">
-  {if $prev}<a href="{$prev}" class="button"><span><div class="icon ui-icon-triangle-1-w"></div> {ts}Prev{/ts}</span></a>{/if}
   {include file="CRM/common/formButtons.tpl" location="bottom"}
-  {if $next}<a href="{$next}" class="button"><span><div class="icon ui-icon-triangle-1-e"></div> {ts}Next{/ts}</span></a>{/if}
 </div>
 
 {literal}
index 5925afec52f67c9aaccd5826c10505bdac6b5396..de4c28177f5a6100749a550c0da24f2e4e80e0d1 100644 (file)
@@ -41,7 +41,7 @@
           <tr class="{cycle values="odd-row,even-row"}">
       <td>{$link}</td>
       <td style="text-align: right">{$merge}</td>
-      <td style="text-align: right"><a id='notDuplicate' href="#" title={ts}not a duplicate{/ts} onClick="processDupes( {$main.srcID}, {$main.dstID}, 'dupe-nondupe' );return false;">{ts}not a duplicate{/ts}</a></td>
+      <td style="text-align: right"><a class='crm-notDuplicate' href="#" title={ts}not a duplicate{/ts} onClick="processDupes( {$main.srcID}, {$main.dstID}, 'dupe-nondupe' );return false;">{ts}not a duplicate{/ts}</a></td>
       </tr>
         {/if}
       {/foreach}
@@ -50,7 +50,7 @@
 </div>
 
 {if $context eq 'search'}
-   <a href="{$backURL}" class="button"><span>{ts}Done{/ts}</span></a>
+   {crmButton href=$backURL icon="close"}{ts}Done{/ts}{/crmButton}
 {else}
    {if $gid}
       {capture assign=backURL}{crmURL p="civicrm/contact/dedupefind" q="reset=1&rgid=`$rgid`&gid=`$gid`&action=renew" a=1}{/capture}
@@ -58,7 +58,7 @@
       {capture assign=backURL}{crmURL p="civicrm/contact/dedupefind" q="reset=1&rgid=`$rgid`&action=renew" a=1}{/capture}
    {/if}
    <a href="{$backURL}" title="{ts}Refresh List of Duplicates{/ts}" onclick="return confirm('{ts escape="js"}This will refresh the duplicates list. Click OK to proceed.{/ts}');" class="button">
-     <span><div class="icon ui-icon-refresh"></div> {ts}Refresh Duplicates{/ts}</span>
+     <span><span class="icon ui-icon-refresh"></span> {ts}Refresh Duplicates{/ts}</span>
    </a>
 
    {if $gid}
index 101d2ba7a7224fa9c81ef0e5dfae8a4539e0f988..2f361c2b0a68338dbdb762d808331d5fd41bde89 100644 (file)
@@ -32,7 +32,7 @@
 <dt>{ts}To{/ts}</dt><dd>{$toName|escape}</dd>
 <dt>{ts}Subject{/ts}</dt><dd>{$subject}</dd>
 <dt>{ts}Message{/ts}</dt><dd>{$message}</dd>
-<dt>&nbsp;</dt><dd><a class="button cancel crm-form-submit" href="{crmURL p='civicrm/contact/view' q="history=1&show=1&selectedChild=activity"}">{ts}Done{/ts}</a></dd>
+<dt>&nbsp;</dt><dd>{crmButton class="cancel" icon="close" p='civicrm/contact/view' q="history=1&show=1&selectedChild=activity"}">{ts}Done{/ts}{/crmButton}</dd>
 </dl>
 </fieldset>
 </div>
index 19151a7fdf82b05b1b22c65d441c0ff774070933..226a132ff319e670816bebc14623f09976e4261a 100644 (file)
@@ -38,7 +38,7 @@
             {/if}
           </table>
           <div class="crm-submit-buttons">
-            <a class="button cancel" href="{crmURL p='civicrm/contact/view' q="selectedChild=note&reset=1&cid=`$contactId`"}">{ts}Done{/ts}</a>
+            {crmButton class="cancel" icon="close" p='civicrm/contact/view' q="selectedChild=note&reset=1&cid=`$contactId`"}{ts}Done{/ts}{/crmButton}
           </div>
 
         {if $comments}
index dbe587fbf36efd9188d44d7224771a6074ea06df..d35de5b4ef3a422cc975400021aa91db4638be74 100644 (file)
@@ -33,7 +33,7 @@
 <dt>{ts}Message{/ts}</dt><dd>{$message}</dd>
 <dt>&nbsp;</dt>
   <dd class="crm-submit-buttons">
-    <a class="button cancel" href="{crmURL p='civicrm/contact/view/activity' q="history=1&show=1"}">{ts}Done{/ts}</a>
+   {crmButton class="cancel" icon="close" p='civicrm/contact/view/activity' q="history=1&show=1"}">{ts}Done{/ts}{/crmButton}
   </dd>
 </dl>
 </fieldset>