No need for crm-button wrappers for real buttons
authorAndrew Hunt <andrew@aghstrategies.com>
Thu, 6 Aug 2020 18:57:11 +0000 (14:57 -0400)
committerAndrew Hunt <andrew@aghstrategies.com>
Tue, 8 Sep 2020 19:39:32 +0000 (15:39 -0400)
12 files changed:
CRM/Admin/Form/Preferences/Display.php
CRM/Batch/Form/Entry.php
CRM/Contact/Form/Contact.php
CRM/Core/Form.php
CRM/Profile/Form.php
CRM/Profile/Form/Edit.php
templates/CRM/Admin/Form/Preferences/Display.tpl
templates/CRM/Admin/Page/APIExplorer.tpl
templates/CRM/Batch/Form/Entry.tpl
templates/CRM/Contact/Form/Contact.tpl
templates/CRM/Profile/Form/Dynamic.tpl
templates/CRM/common/formButtons.tpl

index af824f1f02ae5147b8d596fb58f35df250d3c179..0716cdebd233bd0286546e939b66d674702047af 100644 (file)
@@ -56,6 +56,8 @@ class CRM_Admin_Form_Preferences_Display extends CRM_Admin_Form_Preferences {
       CRM_Core_Page::crmIcon('fa-wrench') . ' ' . ts('Configure CKEditor'),
       [
         'type' => 'submit',
+        'class' => 'crm-button',
+        'style' => 'display:inline-block;vertical-align:middle;float:none!important;',
         'value' => 1,
       ]
     );
index ceb3868d28ff163463f0a85bb80ab1219be60c12..35c407a79f267102716643a7d1e62d989d065c35 100644 (file)
@@ -179,6 +179,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
       [
         'type' => 'submit',
         'value' => 1,
+        'class' => 'crm-button crm-button_qf_Entry_upload_force-save',
       ]
     );
 
index 5d6ce311bc834f1756c9f256a947441e3dd19a0f..798050800c35a5800bdfa950e2b5afecadf30513 100644 (file)
@@ -811,17 +811,28 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form {
     $this->addElement('xbutton',
       $this->_dedupeButtonName,
       ts('Check for Matching Contact(s)'),
-      ['type' => 'submit']
+      [
+        'type' => 'submit',
+        'value' => 1,
+        'class' => "crm-button crm-button{$this->_dedupeButtonName}",
+      ]
     );
     $this->addElement('xbutton',
       $this->_duplicateButtonName,
       ts('Save Matching Contact'),
-      ['type' => 'submit']
+      [
+        'type' => 'submit',
+        'value' => 1,
+        'class' => "crm-button crm-button{$this->_duplicateButtonName}",
+      ]
     );
     $this->addElement('xbutton',
       $this->getButtonName('next', 'sharedHouseholdDuplicate'),
       ts('Save With Duplicate Household'),
-      ['type' => 'submit']
+      [
+        'type' => 'submit',
+        'value' => 1,
+      ]
     );
 
     $buttons = [
index ef81439d24d130ab0b930a8f60796f09c38b008b..fe06bb9915289b3ba8f27b36e1d7c62758aca263 100644 (file)
@@ -714,6 +714,7 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
         }
         $buttonContents = CRM_Core_Page::crmIcon($button['icon'] ?? $defaultIcon) . ' ' . $button['name'];
         $buttonName = $this->getButtonName($button['type'], CRM_Utils_Array::value('subName', $button));
+        $attrs['class'] .= " crm-button crm-button-type-{$button['type']} crm-button{$buttonName}";
         $attrs['type'] = 'submit';
         $prevnext[] = $this->createElement('xbutton', $buttonName, $buttonContents, $attrs);
       }
index c34f1388dd6768b63099dec07c5bbf877cfdd9bb..c6594fd4bd97ae2c3ffcb3851f39836f608d1f9f 100644 (file)
@@ -907,7 +907,10 @@ class CRM_Profile_Form extends CRM_Core_Form {
         'xbutton',
         $this->_duplicateButtonName,
         ts('Save Matching Contact'),
-        ['type' => 'submit']
+        [
+          'type' => 'submit',
+          'class' => 'crm-button',
+        ]
       );
     }
   }
index 758e9711279ca4b65c799cc1d3c4c5b808c1d49b..b2cfc16bf4477b5cb2ece554fffe62cf017824ab 100644 (file)
@@ -212,6 +212,7 @@ SELECT module,is_reserved
       $this->addElement('xbutton', $this->_deleteButtonName, ts('Delete'), [
         'type' => 'submit',
         'value' => 1,
+        'class' => 'crm-button',
       ]);
 
       return;
index 6ee7378d315fac994eb5dfa4f3603fc9ad4cc61d..b06cb53588ac1ce86ea4480b80b344848807e703 100644 (file)
       <td>
         {$form.editor_id.html}
         &nbsp;
-        <span class="crm-button" style="display:inline-block;vertical-align:middle;float:none!important;">
-          {$form.ckeditor_config.html}
-        </span>
+        {$form.ckeditor_config.html}
       </td>
     </tr>
     <tr class="crm-preferences-display-form-block-ajaxPopupsEnabled">
index 98e6529ca16c4aee1483cfc90c7f6d9db9ad049d..2be5f1f3c4abce9ce90fbf526556149db4d08d75 100644 (file)
         </table>
       </div>
       <div class="crm-submit-buttons">
-        <span class="crm-button">
-          <button type="submit" class="crm-form-submit" accesskey="S" title="{ts}Execute API call and display results{/ts}">
-            <i class="crm-i fa-bolt" aria-hidden="true"></i> {ts}Execute{/ts}
-          </button>
-        </span>
+        <button type="submit" class="crm-button crm-form-submit" accesskey="S" title="{ts}Execute API call and display results{/ts}">
+          <i class="crm-i fa-bolt" aria-hidden="true"></i> {ts}Execute{/ts}
+        </button>
       </div>
 
 <pre id="api-result" class="linenums">
index 70c0a1c3506996113f34e5d7419882642921be83..14581e63435925bfbb9896d920435abb20720269 100644 (file)
@@ -22,9 +22,7 @@
     <div class="status message status-warning">
       <i class="crm-i fa-exclamation-triangle" aria-hidden="true"></i> {ts}Total for amounts entered below does not match the expected batch total.{/ts}
     </div>
-    <span class="crm-button crm-button_qf_Entry_upload_force-save">
-      {$form._qf_Entry_upload_force.html}
-    </span>
+    {$form._qf_Entry_upload_force.html}
     <div class="clear"></div>
   {/if}
   <table class="form-layout-compressed batch-totals">
index 2acbff7dccbd4e024b3765ba06675a93dff54081..2844d09e35a4d6fff615ab8af8534c0dd86eb6d5 100644 (file)
           </table>
 
           {*add dupe buttons *}
-          <span class="crm-button crm-button_qf_Contact_refresh_dedupe">
-            {$form._qf_Contact_refresh_dedupe.html}
-          </span>
+          {$form._qf_Contact_refresh_dedupe.html}
           {if $isDuplicate}
             &nbsp;&nbsp;
-              <span class="crm-button crm-button_qf_Contact_upload_duplicate">
-                {$form._qf_Contact_upload_duplicate.html}
-              </span>
+            {$form._qf_Contact_upload_duplicate.html}
           {/if}
           <div class="spacer"></div>
         </div>
     loadMultiRecordFields();
 
     {/literal}{if $oldSubtypes}{literal}
-    $('input[name=_qf_Contact_upload_view], input[name=_qf_Contact_upload_new]').click(function() {
+    $('button[name=_qf_Contact_upload_view], button[name=_qf_Contact_upload_new]').click(function() {
       var submittedSubtypes = $('#contact_sub_type').val();
       var oldSubtypes = {/literal}{$oldSubtypes}{literal};
 
index 2d0240fb886bb3f1ad93a97671dc7f714daa73a0..09ed9986ddd17fa09caafedfecccf6ecf7c949f1 100644 (file)
@@ -19,7 +19,7 @@
   </div>
 
   <div class="crm-submit-buttons">
-    <span class="crm-button">{$form._qf_Edit_upload_delete.html}</span>
+    {$form._qf_Edit_upload_delete.html}
     {if $includeCancelButton}
       <a class="button cancel" href="{$cancelURL}">{$cancelButtonText}</a>
     {/if}
@@ -37,7 +37,7 @@
 
   {if $isDuplicate and ( ($action eq 1 and $mode eq 4 ) or ($action eq 2) or ($action eq 8192) ) }
     <div class="crm-submit-buttons">
-      <span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>
+      {$form._qf_Edit_upload_duplicate.html}
     </div>
   {/if}
   {if $mode eq 1 || $activeComponent neq "CiviCRM"}
@@ -53,7 +53,7 @@
     {if $action eq 2 and $multiRecordFieldListing}
       <h1>{ts}Edit Details{/ts}</h1>
       <div class="crm-submit-buttons" style='float:right'>
-      {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
+      {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if}
       </div>
     {/if}
 
         </div>
       {/if}
       <div class="crm-submit-buttons" style='{$floatStyle}'>
-        {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}<span class="crm-button">{$form._qf_Edit_upload_duplicate.html}</span>{/if}
+        {include file="CRM/common/formButtons.tpl"}{if $isDuplicate}{$form._qf_Edit_upload_duplicate.html}{/if}
         {if $includeCancelButton}
           <a class="button cancel" href="{$cancelURL}">
             <span>
index 0135fe30d104a8ad3c65a614d55fc605e6c8a3b5..10b848a154d29647455a041e32a09b9ffefcb170 100644 (file)
   {/foreach}
 {/if}
 
-{* Loops through $form.buttons.html array and assigns separate spans with classes to allow theming by button and name.
- * crmBtnType grabs type keyword from button name (e.g. 'upload', 'next', 'back', 'cancel') so types of buttons can be styled differently via css.
- *}
 {foreach from=$form.buttons item=button key=key name=btns}
   {if $key|substring:0:4 EQ '_qf_'}
     {if $location}
-      {assign var='html' value=$form.buttons.$key.html|crmReplace:id:"$key-$location"}
+      {$form.buttons.$key.html|crmReplace:id:"$key-$location"}
     {else}
-      {assign var='html' value=$form.buttons.$key.html}
+      {$form.buttons.$key.html}
     {/if}
-    {crmGetAttribute html=$html attr='disabled' assign='disabled'}
-    <span class="crm-button crm-button-type-{$key|crmBtnType} crm-button{$key}{if $disabled} crm-button-disabled{/if}"{if $buttonStyle} style="{$buttonStyle}"{/if}>
-      {$html}
-    </span>
   {/if}
 {/foreach}
 {/crmRegion}