Fix MKWS-376.
authorMike Taylor <mike@indexdata.com>
Wed, 4 Feb 2015 10:06:40 +0000 (10:06 +0000)
committerMike Taylor <mike@indexdata.com>
Wed, 4 Feb 2015 10:06:40 +0000 (10:06 +0000)
The facets and records widgets now interpret a new 'new-search-opacity' configuration setting. If it's defined, then it's an opacity in the range 0.0 (transparent) to 1.0 (opaque), and the widget fades to that opacity when a new search is submitted (reverting to full opacity when data arrives).

src/mkws-widget-facets.js
src/mkws-widget-main.js

index fbf0e47..26d5d9f 100644 (file)
@@ -2,7 +2,14 @@ mkws.registerWidgetType('facets', function() {
   // Initially hide the facets; display when we get results
   var that = this;
   var team = this.team;
+
+  this.team.queue("searchtriggered").subscribe(function() {
+    var op = that.config['new-search-opacity'];
+    if (op !== undefined) { that.node.fadeTo(500, op); }
+  });
+
   team.queue("facets").subscribe(function(data) {
+    that.node.css('opacity', 1);
     that.node.addClass("active");
   });
 
index 8fad7d9..5ddb0b3 100644 (file)
@@ -114,7 +114,13 @@ mkws.registerWidgetType('records', function() {
   var that = this;
   var team = this.team;
 
+  this.team.queue("searchtriggered").subscribe(function() {
+    var op = that.config['new-search-opacity'];
+    if (op !== undefined) { that.node.fadeTo(500, op); }
+  });
+
   this.team.queue("records").subscribe(function(data) {
+    that.node.css('opacity', 1);
     for (var i = 0; i < data.hits.length; i++) {
       var hit = data.hits[i];
       hit.detailLinkId = team.recordElementId(hit.recid[0]);