Merge remote-tracking branch 'upstream/4.4' into 4.4-master-2014-06-25-23-42-42
[civicrm-core.git] / js / jquery / jquery.crmProfileSelector.js
index e150277535074de3f3130e9a849d4c9ed1dce306..7008da85a22b840e1a1827b47d08daf5f464695f 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
@@ -45,7 +45,7 @@
       });
       view.on('change:ufGroupId', function() {
         $(select).val(view.getUfGroupId()).change();
-      })
+      });
       view.render();
       $(select).after(view.el);
       setTimeout(function() {
     });
   };
 
-  // FIXME: this needs a better place to live
-  CRM.scanProfileSelectors = function() {
-    $('.crm-profile-selector').each(function(){
+  $('#crm-container').on('crmLoad', function() {
+    $('.crm-profile-selector:not(.rendered)', this).addClass('rendered').each(function() {
       $(this).crmProfileSelector({
         groupTypeFilter: $(this).attr('data-group-type'),
         entities: $(this).data('entities')
       });
     });
-  };
+  });
 
-})(cj);
+})(CRM.$, CRM._);