From 5f45473068fd170f26fd9261872406b0cef371aa Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Wed, 2 Mar 2011 17:04:41 +0100 Subject: [PATCH] Add facet container template. --- mkdruding2.js | 21 +++++++++++++++++++++ template.php | 3 +++ 2 files changed, 24 insertions(+) diff --git a/mkdruding2.js b/mkdruding2.js index e601817..437a7ed 100644 --- a/mkdruding2.js +++ b/mkdruding2.js @@ -33,3 +33,24 @@ Drupal.theme.mkdruResult = function(hit, num, detailLink) { html += ''; return html; }; + +Drupal.theme.mkdruFacetContainer = function (facetsData, facetsCfg) { + var fs = []; + for (var fname in facetsCfg) { + facetsCfg[fname].originalKey = fname; + fs.push(facetsCfg[fname]); + } + fs.sort(function (a,b) { return a.orderWeight - b.orderWeight }); + var html = '

Facet browser

'; + for (var i=0; i'; + html += '
'; + html += '' + } + html += '
'; + return html; +}; + diff --git a/template.php b/template.php index aa215d8..465af5a 100644 --- a/template.php +++ b/template.php @@ -2,5 +2,8 @@ function mkdruding2_preprocess_page(&$vars, $hook) { //wouold be nice to include this only during search hook drupal_add_js(drupal_get_path('theme', 'mkdruding2') . '/mkdruding2.js'); + //for mkdru to generate facet container client-side in the given element + drupal_add_js(array('mkdru' => array('facetContainerSelector' => + '#block-ding-facetbrowser-facetbrowser')), 'setting'); } -- 1.7.10.4