From b01812e5938609ef68046bdcd726e05c9b2dc3b5 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Tue, 20 Jan 2015 10:03:49 -0500 Subject: [PATCH] CRM-15842 - Custom group form cleanup ---------------------------------------- * CRM-15842: Custom field form improvements https://issues.civicrm.org/jira/browse/CRM-15842 --- CRM/Core/Form.php | 4 ++ CRM/Custom/Form/Group.php | 2 +- templates/CRM/Custom/Form/Group.tpl | 72 ++++++++++++----------------- 3 files changed, 35 insertions(+), 43 deletions(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index b62ce0277a..1877210f4c 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -513,6 +513,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page { foreach ($params as $button) { $attrs = array('class' => 'crm-form-submit') + (array) CRM_Utils_Array::value('js', $button); + if (!empty($button['class'])) { + $attrs['class'] .= ' ' . $button['class']; + } + if (!empty($button['isDefault'])) { $attrs['class'] .= ' default'; } diff --git a/CRM/Custom/Form/Group.php b/CRM/Custom/Form/Group.php index 61b90ecd10..7bcee88ffd 100644 --- a/CRM/Custom/Form/Group.php +++ b/CRM/Custom/Form/Group.php @@ -387,7 +387,7 @@ class CRM_Custom_Form_Group extends CRM_Core_Form { ), ); if (!$this->_isGroupEmpty && !empty($this->_subtypes)) { - $buttons[0]['js'] = array('onclick' => "return warnDataLoss()"); + $buttons[0]['class'] = 'crm-warnDataLoss'; } $this->addButtons($buttons); diff --git a/templates/CRM/Custom/Form/Group.tpl b/templates/CRM/Custom/Form/Group.tpl index 998f3ebc16..6ef11d74f5 100644 --- a/templates/CRM/Custom/Form/Group.tpl +++ b/templates/CRM/Custom/Form/Group.tpl @@ -87,43 +87,31 @@ {/literal} -- 2.25.1