CRM-14383 - Update closures that use lodash
authorColeman Watts <coleman@civicrm.org>
Tue, 25 Mar 2014 19:27:56 +0000 (15:27 -0400)
committerColeman Watts <coleman@civicrm.org>
Tue, 25 Mar 2014 19:27:56 +0000 (15:27 -0400)
CRM/Core/Resources.php
js/Common.js
js/crm.backbone.js
js/jquery/jquery.crmProfileSelector.js
js/model/crm.designer.js
js/model/crm.schema-mapped.js
js/model/crm.uf.js
js/view/crm.designer.js
js/view/crm.profile-selector.js
templates/CRM/Contact/Page/View/Summary.js

index 39b3161360e141570da4459e9e52d2c3202bb9c0..799d1ee2cafe2ceb7490369d6b42a5462cf326ef 100644 (file)
@@ -546,7 +546,7 @@ class CRM_Core_Resources {
       $.fn.select2.defaults.formatNoMatches = " . json_encode(ts("None found.")) . ";
       $.fn.select2.defaults.formatLoadMore = " . json_encode(ts("Loading...")) . ";
       $.fn.select2.defaults.formatSearching = " . json_encode(ts("Searching...")) . ";
-      $.fn.select2.defaults.formatInputTooShort = function(){return cj(this).data('api-entity') == 'contact' ? $contactSearch : $otherSearch};
+      $.fn.select2.defaults.formatInputTooShort = function(){return CRM.$(this).data('api-entity') == 'contact' ? $contactSearch : $otherSearch};
     ";
 
     // Contact create profiles with localized names
index 3cf1ffb093469b8580153c05cca034928f97af21..8e5d854e3a9229af9f4d2d93c28fc3781a8d82b2 100644 (file)
@@ -1,6 +1,7 @@
 // https://civicrm.org/licensing
 var CRM = CRM || {};
-var cj = jQuery;
+var cj = CRM.$ = jQuery;
+CRM._ = _;
 
 /**
  * Short-named function for string translation, defined in global scope so it's available everywhere.
@@ -199,7 +200,7 @@ CRM.validate = CRM.validate || {
   functions: []
 };
 
-(function ($, undefined) {
+(function ($, _, undefined) {
   "use strict";
 
   // Theme classes for unattached elements
@@ -866,4 +867,4 @@ CRM.validate = CRM.validate || {
     result = sign + (j ? i.substr(0, j) + separator : '') + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + separator) + (2 ? decimal + Math.abs(value - i).toFixed(2).slice(2) : '');
     return format.replace(/1.*234.*56/, result);
   };
-})(jQuery);
+})(jQuery, _);
index 46ed6998081e63418d4a2bf27576fdfe11d2ed64..eb45249c1717e9fd3ac194efdfc7d0a811baabb0 100644 (file)
@@ -1,5 +1,4 @@
-(function($) {
-  var CRM = (window.CRM) ? (window.CRM) : (window.CRM = {});
+(function($, _) {
   if (!CRM.Backbone) CRM.Backbone = {};
 
   /**
   var wrapError = function (model, options) {
     var error = options.error;
     options.error = function(resp) {
-      if (error) error(model, resp, options);
+      if (error) error(model, resp, optio)
       model.trigger('error', model, resp, options);
     };
   };
-})(cj);
+})(CRM.$, CRM._);
index 3c09e7f4608ed1382b8fd5122e7fad3f0eba4ea4..98da5842c3eb3605569939c74778625bb3453cb0 100644 (file)
@@ -1,4 +1,4 @@
-(function($) {
+(function($, _) {
   var ufGroupCollection = new CRM.UF.UFGroupCollection(_.sortBy(CRM.initialProfileList.values, 'title'));
   //var ufGroupCollection = new CRM.UF.UFGroupCollection(CRM.initialProfileList.values, {
   //  comparator: 'title' // no point, this doesn't work with subcollections
@@ -63,4 +63,4 @@
     });
   });
 
-})(cj);
+})(CRM.$, CRM._);
index 729778ae6a4775a68208972aaca89551eed7cb01..2553b157f618f28df4b7bbe3d0db16c5114574df 100644 (file)
@@ -1,5 +1,4 @@
-(function($) {
-  var CRM = (window.CRM) ? (window.CRM) : (window.CRM = {});
+(function($, _) {
   if (!CRM.Designer) CRM.Designer = {};
 
   // TODO Optimize this class
       return fieldsByEntitySection;
     }
   });
-})(cj);
+})(CRM.$, CRM._);
index 7dbc192d27d7a93ab198d70512b37032ad26906a..1a59c0e73f66d5a854847723e4f25ffa155ca670 100644 (file)
@@ -1,8 +1,7 @@
 /**
  * Dynamically-generated alternative to civi.core.js
  */
-(function($) {
-  var CRM = (window.CRM) ? (window.CRM) : (window.CRM = {});
+(function($, _) {
   if (!CRM.Schema) CRM.Schema = {};
 
   /**
@@ -45,4 +44,4 @@
   };
 
   CRM.Schema.loadModels(CRM.civiSchema);
-})(cj);
\ No newline at end of file
+})(CRM.$, CRM._);
index f75cbbff8d26d3feb826e14b16999c5a7fd09639..c5c2563e388a6490128c1d7514cc600fb8c5348b 100644 (file)
@@ -1,5 +1,4 @@
-(function($) {
-  var CRM = (window.CRM) ? (window.CRM) : (window.CRM = {});
+(function($, _) {
   if (!CRM.UF) CRM.UF = {};
 
   var YESNO = [
   CRM.UF.UFGroupCollection = CRM.Backbone.Collection.extend({
     model: CRM.UF.UFGroupModel
   });
-})(cj);
+})(CRM.$, CRM._);
index 01e75f26bdb068f59dd6f0c0c53c539755998740..d43f1ccfb6b5375a937fcd81d4b326b61ab5ef87 100644 (file)
@@ -1,4 +1,4 @@
-(function($) {
+(function($, _) {
   if (!CRM.Designer) CRM.Designer = {};
 
   /**
     }
   });
 
-})(cj);
+})(CRM.$, CRM._);
index 306279a2509c575c46960b9015aeddbc1a106906..6521f195726395c2e9fb5e27f8b969630f86313d 100644 (file)
@@ -1,5 +1,4 @@
-(function($) {
-  var CRM = (window.CRM) ? (window.CRM) : (window.CRM = {});
+(function($, _) {
   if (!CRM.ProfileSelector) CRM.ProfileSelector = {};
 
   CRM.ProfileSelector.Option = Backbone.Marionette.ItemView.extend({
       view.render();
     }
   });
-})(cj);
+})(CRM.$, CRM._);
index 15331c3171e5c64da8e721ac7ab6b198dd202004..ef63940e86a8e95754f1b05be2084716dd6f3eaa 100644 (file)
@@ -1,5 +1,5 @@
 // http://civicrm.org/licensing
-(function($) {
+(function($, _) {
 
   var ajaxFormParams = {
     dataType:'json',
       });
     $().crmAccordions();
   });
-})(cj);
+})(CRM.$, CRM._);