From: Jakub Skoczen Date: Wed, 2 Mar 2011 15:14:47 +0000 (+0100) Subject: Add theme function to draw facet container X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=08871a2c8216c8b9a6c39104402dc55e07df5cf3;p=mkdru-moved-to-drupal.org.git Add theme function to draw facet container Also add elements to control facet dislayName and order. --- diff --git a/mkdru.client.js b/mkdru.client.js index c73e875..fdb54e6 100644 --- a/mkdru.client.js +++ b/mkdru.client.js @@ -8,21 +8,28 @@ var mkdru = { totalRec: 0, pagerRange: 6, pazpar2Path: Drupal.settings.mkdru.pz2_path, + facetContainerSelector: Drupal.settings.mkdru.facetContainerSelector, // Facets facets: { source: { + displayName: Drupal.settings.mkdru.source_dname || "Source", + orderWeight: Drupal.settings.mkdru.source_weight || 1, pz2Name: 'xtargets', - max: Drupal.settings.mkdru.source_max + max: Drupal.settings.mkdru.source_max || 10 }, subject: { + displayName: Drupal.settings.mkdru.subject_dname || "Subject", + orderWeight: Drupal.settings.mkdru.source_weight || 2, pz2Name: 'subject', - max: Drupal.settings.mkdru.subject_max, + max: Drupal.settings.mkdru.subject_max || 10, multiLimit: true, limiter: 'su' }, author: { + displayName: Drupal.settings.mkdru.author_dname || "Author", + orderWeight: Drupal.settings.mkdru.source_weight || 3, pz2Name: 'author', - max: Drupal.settings.mkdru.author_max, + max: Drupal.settings.mkdru.author_max || 10, multiLimit: false, limiter: 'au' } @@ -116,6 +123,11 @@ mkdru.pz2Status = function (data) { }; mkdru.pz2Term = function (data) { + // if signaled, prepare container client-side + if (mkdru.facetContainerSelector) { + $(mkdru.facetContainerSelector).html(Drupal.theme('mkdruFacetContainer', + data, mkdru.facets)); + } for (var facet in mkdru.facets) { // facet is limited if (mkdru.state['limit_' + facet]) { @@ -409,4 +421,4 @@ $(document).ready(function () { ); } }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/mkdru.theme.js b/mkdru.theme.js index 745106e..8051e40 100644 --- a/mkdru.theme.js +++ b/mkdru.theme.js @@ -111,6 +111,7 @@ Drupal.theme.prototype.mkdruStatus = function(activeClients, clients) { }; Drupal.theme.prototype.mkdruFacet = function (terms, facet, max) { + debugger; var html = ""; for (var i = 0; i < terms.length && i < max; i++ ) { html += '' + Drupal.t('Show all...') + '

'; } -}; \ No newline at end of file +}; + +Drupal.theme.prototype.mkdruFacetContainer = function (facets, facetCfg) { + return ""; +};