From: Dave Greenberg Date: Tue, 4 Feb 2014 00:40:35 +0000 (-0800) Subject: CRM-14161 - adjust width and height of multi-select widgets on New Mailing form to... X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=50c9bb4aa77c096ff9f8cc915bfb5beab46509bc;p=civicrm-core.git CRM-14161 - adjust width and height of multi-select widgets on New Mailing form to handle long names. ---------------------------------------- * CRM-14161: New Mailing form - adjust height and width of multi-select fields to better accommodate long names http://issues.civicrm.org/jira/browse/CRM-14161 --- diff --git a/CRM/Mailing/Form/Group.php b/CRM/Mailing/Form/Group.php index 311f793f0e..23abb0c3bb 100644 --- a/CRM/Mailing/Form/Group.php +++ b/CRM/Mailing/Form/Group.php @@ -236,12 +236,19 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task { ); } + if (count($groups) <= 10) { + // setting minimum height to 2 since widget looks strange when size (height) is 1 + $groupSize = max(count($groups), 2); + } + else { + $groupSize = 10; + } $inG = &$this->addElement('advmultiselect', 'includeGroups', ts('Include Group(s)') . ' ', $groups, array( - 'size' => 5, - 'style' => 'width:240px', + 'size' => $groupSize, + 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect', ) ); @@ -255,8 +262,8 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task { ts('Exclude Group(s)') . ' ', $groups, array( - 'size' => 5, - 'style' => 'width:240px', + 'size' => $groupSize, + 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect', ) ); @@ -266,12 +273,19 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task { $inG->setButtonAttributes('remove', array('value' => ts('<< Remove'))); $outG->setButtonAttributes('remove', array('value' => ts('<< Remove'))); + if (count($mailings) <= 10) { + // setting minimum height to 2 since widget looks strange when size (height) is 1 + $mailingSize = max(count($mailings), 2); + } + else { + $mailingSize = 10; + } $inM = &$this->addElement('advmultiselect', 'includeMailings', ts('INCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array( - 'size' => 5, - 'style' => 'width:240px', + 'size' => $mailingSize, + 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect', ) ); @@ -279,8 +293,8 @@ class CRM_Mailing_Form_Group extends CRM_Contact_Form_Task { ts('EXCLUDE Recipients of These Mailing(s)') . ' ', $mailings, array( - 'size' => 5, - 'style' => 'width:240px', + 'size' => $mailingSize, + 'style' => 'width:auto; min-width:240px;', 'class' => 'advmultiselect', ) );