Facet captions and maximum counts are now taken from optional
authorMike Taylor <mike@indexdata.com>
Fri, 16 May 2014 15:43:12 +0000 (16:43 +0100)
committerMike Taylor <mike@indexdata.com>
Fri, 16 May 2014 15:43:12 +0000 (16:43 +0100)
configuration settings "facet_caption_NAME" and "facet_max_NAME",
defaulting to their own hardwired values when these settings are
absent.

Fixes bug MWKS-192.

src/mkws-widget-termlists.js

index addfd94..dc89504 100644 (file)
@@ -30,9 +30,9 @@ mkws.registerWidgetType('Facet', function() {
 
   var that = this;
   var name = that.config.facet;
-  var ref = facetConfig[name] || alert("no facet definition for '" + name + "'");
-  var caption = ref[0];
-  var max = ref[1];
+  var ref = facetConfig[name] || [ "Unknown", 10, true ];
+  var caption = this.config['facet_caption_' + name] || ref[0];
+  var max     = this.config['facet_max_' + name]     || ref[1];
   var pzIndex = ref[2] ? name : null;
 
   that.toString = function() {