CRM-15249 - ProfileSelector view cleanup and css fix
authorColeman Watts <coleman@civicrm.org>
Sat, 6 Sep 2014 17:32:05 +0000 (13:32 -0400)
committerColeman Watts <coleman@civicrm.org>
Sat, 6 Sep 2014 17:32:05 +0000 (13:32 -0400)
css/crm.designer.css
js/jquery/jquery.crmProfileSelector.js

index e5cd2c4ce8411e66d40ebc56f0bd14637e11a029..a1d9ff7efe7667e56e3da397538ae8641f04424a 100644 (file)
@@ -1,6 +1,3 @@
-.crm-profile-selector {
-    display: none;
-}
 .crm-profile-selector-preview-pane {
     width: 75%;
     min-width: 500px;
index 7008da85a22b840e1a1827b47d08daf5f464695f..f97333552078d0ca177ef23e89e6ad5d0fa202a5 100644 (file)
@@ -25,9 +25,9 @@
     return this.each(function() {
       // Hide the existing <SELECT> and instead construct a ProfileSelector view.
       // Keep them synchronized.
-      var select = this;
+      var matchingUfGroups,
+        $select = $(this).hide().addClass('rendered');
 
-      var matchingUfGroups;
       if (options.groupTypeFilter) {
         matchingUfGroups = ufGroupCollection.subcollection({
           filter: function(ufGroupModel) {
       }
 
       var view = new CRM.ProfileSelector.View({
-        ufGroupId: $(select).val(),
+        ufGroupId: $select.val(),
         ufGroupCollection: matchingUfGroups,
         ufEntities: options.entities
       });
       view.on('change:ufGroupId', function() {
-        $(select).val(view.getUfGroupId()).change();
+        $select.val(view.getUfGroupId()).change();
       });
       view.render();
-      $(select).after(view.el);
+      $select.after(view.el);
       setTimeout(function() {
         view.doPreview();
       }, 100);
@@ -55,9 +55,9 @@
   };
 
   $('#crm-container').on('crmLoad', function() {
-    $('.crm-profile-selector:not(.rendered)', this).addClass('rendered').each(function() {
+    $('.crm-profile-selector:not(.rendered)', this).each(function() {
       $(this).crmProfileSelector({
-        groupTypeFilter: $(this).attr('data-group-type'),
+        groupTypeFilter: $(this).data('groupType'),
         entities: $(this).data('entities')
       });
     });