CRM-14161 - adjust width and height of multi-select widgets on New Mailing form to...
authorDave Greenberg <dave@civicrm.org>
Tue, 4 Feb 2014 00:40:35 +0000 (16:40 -0800)
committerDave Greenberg <dave@civicrm.org>
Tue, 4 Feb 2014 00:40:35 +0000 (16:40 -0800)
----------------------------------------
* 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

CRM/Mailing/Form/Group.php

index 311f793f0e5e8e4ad659f1341c4162a6806a2600..23abb0c3bb3ab7313962f806e572dab087b0bd48 100644 (file)
@@ -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',
       )
     );