From aeb97cc11ef068876f84af5a3b7f07bf06a44788 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 8 Feb 2015 12:01:48 -0500 Subject: [PATCH] CRM-15789 - Button cleanup ---------------------------------------- * CRM-15789: Add icons to submit buttons https://issues.civicrm.org/jira/browse/CRM-15789 --- CRM/Admin/Form/Setting/Smtp.php | 5 +++-- CRM/Contact/Form/DedupeFind.php | 2 ++ CRM/Contact/Page/AJAX.php | 7 +++++-- CRM/Core/Smarty/plugins/block.crmButton.php | 4 +++- templates/CRM/Admin/Form/Setting/Smtp.tpl | 10 ++++------ templates/CRM/Contact/Form/Merge.tpl | 8 +++----- templates/CRM/Contact/Page/DedupeFind.tpl | 6 +++--- templates/CRM/Contact/Page/View/Email.tpl | 2 +- templates/CRM/Contact/Page/View/Note.tpl | 2 +- templates/CRM/Contact/Page/View/SMS.tpl | 2 +- 10 files changed, 26 insertions(+), 22 deletions(-) diff --git a/CRM/Admin/Form/Setting/Smtp.php b/CRM/Admin/Form/Setting/Smtp.php index 9655de1bd5..592093e35f 100644 --- a/CRM/Admin/Form/Setting/Smtp.php +++ b/CRM/Admin/Form/Setting/Smtp.php @@ -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); } /** diff --git a/CRM/Contact/Form/DedupeFind.php b/CRM/Contact/Form/DedupeFind.php index 587f58fa3a..89bed60359 100644 --- a/CRM/Contact/Form/DedupeFind.php +++ b/CRM/Contact/Form/DedupeFind.php @@ -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'), ), ) diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 14ae97970e..256c1f8be9 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -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'] .= " |  " . ts('not a duplicate') . ""; + $searchRows[$mainId]['actions'] = '' . ts('merge') . ''; + $searchRows[$mainId]['actions'] .= "" . ts('not a duplicate') . ""; } else { $searchRows[$mainId]['actions'] = '' . ts('Insufficient access rights - cannot merge') . ''; @@ -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); diff --git a/CRM/Core/Smarty/plugins/block.crmButton.php b/CRM/Core/Smarty/plugins/block.crmButton.php index 6bc7f906ca..6ccd8e53a0 100644 --- a/CRM/Core/Smarty/plugins/block.crmButton.php +++ b/CRM/Core/Smarty/plugins/block.crmButton.php @@ -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 diff --git a/templates/CRM/Admin/Form/Setting/Smtp.tpl b/templates/CRM/Admin/Form/Setting/Smtp.tpl index 99cbc6f888..b8754c5cc8 100644 --- a/templates/CRM/Admin/Form/Setting/Smtp.tpl +++ b/templates/CRM/Admin/Form/Setting/Smtp.tpl @@ -91,8 +91,6 @@
{include file="CRM/common/formButtons.tpl"} -      - {$form._qf_Smtp_refresh_test.html}
@@ -110,7 +108,7 @@ case "0": $("#bySMTP").show( ); $("#bySendmail").hide( ); - $("#_qf_Smtp_refresh_test").show( ); + $("#_qf_Smtp_refresh_test").prop('disabled', false); if (mailSetting == '5') { alert(archiveWarning); } @@ -118,14 +116,14 @@ 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); } @@ -133,7 +131,7 @@ default: $("#bySMTP").hide( ); $("#bySendmail").hide( ); - $("#_qf_Smtp_refresh_test").hide( ); + $("#_qf_Smtp_refresh_test").prop('disabled', true); } } diff --git a/templates/CRM/Contact/Form/Merge.tpl b/templates/CRM/Contact/Form/Merge.tpl index a82205402f..fad476bd13 100644 --- a/templates/CRM/Contact/Form/Merge.tpl +++ b/templates/CRM/Contact/Form/Merge.tpl @@ -29,9 +29,9 @@
- {if $prev}
{ts}Prev{/ts}
{/if} {include file="CRM/common/formButtons.tpl" location="top"} - {if $next}
{ts}Next{/ts}
{/if} + {if $prev} {ts}Previous{/ts}{/if} + {if $next}{ts}Next{/ts} {/if}
- {if $prev}
{ts}Prev{/ts}
{/if} {include file="CRM/common/formButtons.tpl" location="bottom"} - {if $next}
{ts}Next{/ts}
{/if}
{literal} diff --git a/templates/CRM/Contact/Page/DedupeFind.tpl b/templates/CRM/Contact/Page/DedupeFind.tpl index 5925afec52..de4c28177f 100644 --- a/templates/CRM/Contact/Page/DedupeFind.tpl +++ b/templates/CRM/Contact/Page/DedupeFind.tpl @@ -41,7 +41,7 @@ {$link} {$merge} - {ts}not a duplicate{/ts} + {ts}not a duplicate{/ts} {/if} {/foreach} @@ -50,7 +50,7 @@ {if $context eq 'search'} - {ts}Done{/ts} + {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} -
{ts}Refresh Duplicates{/ts}
+ {ts}Refresh Duplicates{/ts}
{if $gid} diff --git a/templates/CRM/Contact/Page/View/Email.tpl b/templates/CRM/Contact/Page/View/Email.tpl index 101d2ba7a7..2f361c2b0a 100644 --- a/templates/CRM/Contact/Page/View/Email.tpl +++ b/templates/CRM/Contact/Page/View/Email.tpl @@ -32,7 +32,7 @@
{ts}To{/ts}
{$toName|escape}
{ts}Subject{/ts}
{$subject}
{ts}Message{/ts}
{$message}
-
 
{ts}Done{/ts}
+
 
{crmButton class="cancel" icon="close" p='civicrm/contact/view' q="history=1&show=1&selectedChild=activity"}">{ts}Done{/ts}{/crmButton}
diff --git a/templates/CRM/Contact/Page/View/Note.tpl b/templates/CRM/Contact/Page/View/Note.tpl index 19151a7fdf..226a132ff3 100644 --- a/templates/CRM/Contact/Page/View/Note.tpl +++ b/templates/CRM/Contact/Page/View/Note.tpl @@ -38,7 +38,7 @@ {/if}
- {ts}Done{/ts} + {crmButton class="cancel" icon="close" p='civicrm/contact/view' q="selectedChild=note&reset=1&cid=`$contactId`"}{ts}Done{/ts}{/crmButton}
{if $comments} diff --git a/templates/CRM/Contact/Page/View/SMS.tpl b/templates/CRM/Contact/Page/View/SMS.tpl index dbe587fbf3..d35de5b4ef 100644 --- a/templates/CRM/Contact/Page/View/SMS.tpl +++ b/templates/CRM/Contact/Page/View/SMS.tpl @@ -33,7 +33,7 @@
{ts}Message{/ts}
{$message}
 
- {ts}Done{/ts} + {crmButton class="cancel" icon="close" p='civicrm/contact/view/activity' q="history=1&show=1"}">{ts}Done{/ts}{/crmButton}
-- 2.25.1