Per-facet templates.
authorJason Skomorowski <jason@indexdata.com>
Tue, 8 Jul 2014 00:32:13 +0000 (20:32 -0400)
committerJason Skomorowski <jason@indexdata.com>
Tue, 8 Jul 2014 00:32:13 +0000 (20:32 -0400)
src/mkws-widget-termlists.js

index 54c65c4..294f3ff 100644 (file)
@@ -59,7 +59,19 @@ mkws.registerWidgetType('Facet', function() {
         linkdata: linkdata
       }); 
     }
-    var template = team.loadTemplate(that.config.template || "Facet");
+    // configured template > facet specific template > default facet template
+    var template;
+    if (that.config.template) {
+      template = team.loadTemplate(that.config.template);
+    } else {
+      template = team.loadTemplate("Facet-" + caption);
+      if (template) {
+        that.log("Using Facet-" + caption + " template.")
+      } else {
+        that.log("No " + caption + " specific template, using default.")
+        template = team.loadTemplate("Facet");
+      }
+    }
     that.node.html(template({
       name: name,
       caption: caption,