Cleanup location of summary-specific js
authorColeman Watts <coleman@civicrm.org>
Sat, 4 Apr 2015 01:22:05 +0000 (21:22 -0400)
committerColeman Watts <coleman@civicrm.org>
Sat, 4 Apr 2015 01:22:05 +0000 (21:22 -0400)
js/Common.js
templates/CRM/Contact/Page/View/Summary.js

index b94f803fe290cf5d84fab200f4e6af6e25100194..1b08d777f7072a47f6f42b9dbe3f17d0d191f0ff 100644 (file)
@@ -879,63 +879,6 @@ CRM.strings = CRM.strings || {};
     }
   };
 
-  /**
-   * Function to make multiselect boxes behave as fields in small screens
-   */
-  function advmultiselectResize() {
-    var amswidth = $("#crm-container form:has(table.advmultiselect)").width();
-    if (amswidth < 700) {
-      $("form table.advmultiselect td").css('display', 'block');
-    }
-    else {
-      $("form table.advmultiselect td").css('display', 'table-cell');
-    }
-    var contactwidth = $('#crm-container #mainTabContainer').width();
-    if (contactwidth < 600) {
-      $('#crm-container #mainTabContainer').addClass('narrowpage');
-      $('#crm-container #mainTabContainer.narrowpage #contactTopBar td').each(function (index) {
-        if (index > 1) {
-          if (index % 2 === 0) {
-            $(this).parent().after('<tr class="narrowadded"></tr>');
-          }
-          var item = $(this);
-          $(this).parent().next().append(item);
-        }
-      });
-    }
-    else {
-      $('#crm-container #mainTabContainer.narrowpage').removeClass('narrowpage');
-      $('#crm-container #mainTabContainer #contactTopBar tr.narrowadded td').each(function () {
-        var nitem = $(this);
-        var parent = $(this).parent();
-        $(this).parent().prev().append(nitem);
-        if (parent.children().size() === 0) {
-          parent.remove();
-        }
-      });
-      $('#crm-container #mainTabContainer.narrowpage #contactTopBar tr.added').detach();
-    }
-    var cformwidth = $('#crm-container #Contact .contact_basic_information-section').width();
-
-    if (cformwidth < 720) {
-      $('#crm-container .contact_basic_information-section').addClass('narrowform');
-      $('#crm-container .contact_basic_information-section table.form-layout-compressed td .helpicon').parent().addClass('hashelpicon');
-      if (cformwidth < 480) {
-        $('#crm-container .contact_basic_information-section').addClass('xnarrowform');
-      }
-      else {
-        $('#crm-container .contact_basic_information-section.xnarrowform').removeClass('xnarrowform');
-      }
-    }
-    else {
-      $('#crm-container .contact_basic_information-section.narrowform').removeClass('narrowform');
-      $('#crm-container .contact_basic_information-section.xnarrowform').removeClass('xnarrowform');
-    }
-  }
-
-  advmultiselectResize();
-  $(window).resize(advmultiselectResize);
-
   $.fn.crmtooltip = function () {
     $(document)
       .on('mouseover', 'a.crm-summary-link:not(.crm-processed)', function (e) {
index f38bf305b5a49f3c76da70fdb7c1f7d76f6e1824..6021ee449cda4d0b799e7fe709c613f61de86134 100644 (file)
           reloadBlock(data.reloadBlocks.join(','));
         }
       });
+
+    /**
+     * Make contact summary fit in small screens
+     */
+    function onResize() {
+      var contactwidth = $('#crm-container #mainTabContainer').width();
+      if (contactwidth < 600) {
+        $('#crm-container #mainTabContainer').addClass('narrowpage');
+        $('#crm-container #mainTabContainer.narrowpage #contactTopBar td').each(function (index) {
+          if (index > 1) {
+            if (index % 2 === 0) {
+              $(this).parent().after('<tr class="narrowadded"></tr>');
+            }
+            var item = $(this);
+            $(this).parent().next().append(item);
+          }
+        });
+      }
+      else {
+        $('#crm-container #mainTabContainer.narrowpage').removeClass('narrowpage');
+        $('#crm-container #mainTabContainer #contactTopBar tr.narrowadded td').each(function () {
+          var nitem = $(this);
+          var parent = $(this).parent();
+          $(this).parent().prev().append(nitem);
+          if (parent.children().size() === 0) {
+            parent.remove();
+          }
+        });
+        $('#crm-container #mainTabContainer.narrowpage #contactTopBar tr.added').detach();
+      }
+      var cformwidth = $('#crm-container #Contact .contact_basic_information-section').width();
+
+      if (cformwidth < 720) {
+        $('#crm-container .contact_basic_information-section').addClass('narrowform');
+        $('#crm-container .contact_basic_information-section table.form-layout-compressed td .helpicon').parent().addClass('hashelpicon');
+        if (cformwidth < 480) {
+          $('#crm-container .contact_basic_information-section').addClass('xnarrowform');
+        }
+        else {
+          $('#crm-container .contact_basic_information-section.xnarrowform').removeClass('xnarrowform');
+        }
+      }
+      else {
+        $('#crm-container .contact_basic_information-section.narrowform').removeClass('narrowform');
+        $('#crm-container .contact_basic_information-section.xnarrowform').removeClass('xnarrowform');
+      }
+    }
+
+    onResize();
+    $(window).resize(onResize);
   });
 })(CRM.$, CRM._);