Move facet container set-up to onload
[mkdru-moved-to-drupal.org.git] / mkdru.theme.js
index bcf9de9..13886d9 100644 (file)
@@ -110,7 +110,7 @@ Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) {
          + clients + Drupal.t(' targets');
 };
 
-Drupal.theme.prototype.mkdruFacet = function (terms, facet, max) {
+Drupal.theme.prototype.mkdruFacet = function (terms, facet, max, selections) {
   var html = "";
   for (var i = 0; i < terms.length && i < max; i++ ) {
     var term = terms[i];
@@ -120,11 +120,20 @@ Drupal.theme.prototype.mkdruFacet = function (terms, facet, max) {
     if (term.selected) html += "</strong>";
     html += '</a><span> (' + terms[i].freq
         + ')</span><br/>';
-
+  }
+  //TODO, meed to look up target name from ID
+  if (terms.length == 0 && selections && selections.length) {
+    for (var i=0; i<selections.length; i++) {
+      if (selections[i]) {
+        html += '<a class="cross" href="'
+          + mkdru.removeLimit(facet, selections[i])
+          + '"><strong>'+selections[i]+'</strong></a><span> (0)</span><br/>';
+      }
+    } 
   }
   return html;
 };
 
-Drupal.theme.prototype.mkdruFacetContainer = function (facets, facetCfg) {
+Drupal.theme.prototype.mkdruFacetContainer = function (facetCfg) {
   return "";
 };