X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-widget-main.js;h=a70e7d2ba9bc16db0f753a86ed2284ce16b1392f;hb=c99baaffc70d90ad50a021cad5ccc6aa1dccc9ba;hp=650ed91c8f51c6a3fda7ca49c5049f6310cdf688;hpb=1c08c02c5646499abb70f025e374ceb4517df311;p=mkws-moved-to-github.git
diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js
index 650ed91..a70e7d2 100644
--- a/src/mkws-widget-main.js
+++ b/src/mkws-widget-main.js
@@ -4,11 +4,12 @@
mkws.registerWidgetType('Targets', function() {
+ if (!this.config.show_switch) return;
var that = this;
var M = mkws.M;
- $(this.node).html('No information available yet.');
- $(this.node).css("display", "none");
+ this.jqnode.html('No information available yet.');
+ this.jqnode.css("display", "none");
this.team.queue("targets").subscribe(function(data) {
var table ='
' +
@@ -28,7 +29,7 @@ mkws.registerWidgetType('Targets', function() {
}
table += '
';
- $(that.node).html(table);
+ that.jqnode.html(table);
});
});
@@ -38,12 +39,10 @@ mkws.registerWidgetType('Stat', function() {
var M = mkws.M;
this.team.queue("stat").subscribe(function(data) {
- if (that.node.length === 0) alert("huh?!");
-
- $(that.node).html(' -- ' +
+ that.jqnode.html(' -- ' +
'' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '' +
' -- ' +
- '' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '');
+ M('Retrieved records') + ': ' + data.records + '/' + data.hits);
});
});
@@ -53,7 +52,7 @@ mkws.registerWidgetType('Pager', function() {
var M = mkws.M;
this.team.queue("pager").subscribe(function(data) {
- $(that.node).html(drawPager(data))
+ that.jqnode.html(drawPager(data))
function drawPager(data) {
var teamName = that.team.name();
@@ -122,7 +121,7 @@ mkws.registerWidgetType('Records', function() {
var hit = data.hits[i];
that.team.queue("record").publish(hit);
var divId = team.recordElementId(hit.recid[0]);
- html.push('', renderSummary(hit), '
');
+ html.push('', renderSummary(hit), '
');
// ### At some point, we may be able to move the
// m_currentRecordId and m_currentRecordData members
// from the team object into this widget.
@@ -131,7 +130,7 @@ mkws.registerWidgetType('Records', function() {
html.push(team.renderDetails(team.currentRecordData()));
}
}
- $(that.node).html(html.join(''));
+ that.jqnode.html(html.join(''));
function renderSummary(hit) {
var template = team.loadTemplate(that.config.template || "Summary");
@@ -167,7 +166,7 @@ mkws.registerWidgetType('Navi', function() {
');return false;">' + value + '';
});
- $(that.node).html(text);
+ that.jqnode.html(text);
});
});
@@ -178,8 +177,8 @@ mkws.registerWidgetType('Navi', function() {
mkws.registerWidgetType('Sort', function() {
var that = this;
- $(this.node).change(function() {
- that.team.set_sortOrder($(that.node).val());
+ this.jqnode.change(function() {
+ that.team.set_sortOrder(that.jqnode.val());
if (that.team.submitted()) {
that.team.reShow();
}
@@ -191,8 +190,8 @@ mkws.registerWidgetType('Sort', function() {
mkws.registerWidgetType('Perpage', function() {
var that = this;
- $(this.node).change(function() {
- that.team.set_perpage($(that.node).val());
+ this.jqnode.change(function() {
+ that.team.set_perpage(that.jqnode.val());
if (that.team.submitted()) {
that.team.reShow();
}
@@ -205,14 +204,15 @@ mkws.registerWidgetType('Done', function() {
var that = this;
this.team.queue("complete").subscribe(function(n) {
- $(that.node).html("Search complete: found " + n + " records");
+ that.jqnode.html("Search complete: found " + n + " records");
});
});
mkws.registerWidgetType('Switch', function() {
+ if (!this.config.show_switch) return;
var tname = this.team.name();
- $(this.node).html('\
+ this.jqnode.html('\
Records \
| \
Targets');
@@ -224,7 +224,7 @@ mkws.registerWidgetType('Search', function() {
var tname = this.team.name();
var M = mkws.M;
- $(this.node).html('\
+ this.jqnode.html('\