X-Git-Url: http://jsfdemo.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-widgets.js;h=517850bc3dbcb85cd7dd800540e7b1435206e660;hb=df823384f61228cdcedc53999e44dc4704c858f9;hp=9f6c4182ffcf7e0d47291e7ea94ef11780837c0e;hpb=1fa8dadcde2ae039195d40477c8174f346a894b7;p=mkws-moved-to-github.git diff --git a/src/mkws-widgets.js b/src/mkws-widgets.js index 9f6c418..517850b 100644 --- a/src/mkws-widgets.js +++ b/src/mkws-widgets.js @@ -222,6 +222,13 @@ mkws.registerWidgetType('Pager', function() { }); +mkws.registerWidgetType('Results', function() { + // Nothing to do apart from act as an autosearch trigger + // Contained elements do all the real work + widget.autosearch(this); +}); + + mkws.registerWidgetType('Records', function() { var that = this; var team = this.team; @@ -230,6 +237,7 @@ mkws.registerWidgetType('Records', function() { var html = []; for (var i = 0; i < data.hits.length; i++) { var hit = data.hits[i]; + that.team.queue("record").publish(hit); var divId = team.recordElementId(hit.recid[0]); html.push('
', renderSummary(hit), '
'); // ### At some point, we may be able to move the @@ -263,20 +271,18 @@ mkws.registerWidgetType('Navi', function() { var filters = that.team.filters(); var text = ""; - for (var i in filters) { - if (text) { - text += " | "; - } - var filter = filters[i]; - if (filter.id) { - text += M('source') + ': ' + filter.name + ''; - } else { - text += M(filter.field) + ': ' + filter.value + ''; - } - } + filters.visitTargets(function(id, name) { + if (text) text += " | "; + text += M('source') + ': ' + name + ''; + }); + + filters.visitFields(function(field, value) { + if (text) text += " | "; + text += M(field) + ': ' + value + ''; + }); $(that.node).html(text); });