+(function($) { // jQuery wrapper
+
// Functions follow for promoting the regular widget object into
// widgets of specific types. These could be moved into their own
// source files.
});
});
+mkws.registerWidgetType('Details', function() {
+ var that = this;
+ var recid = that.node.attr("data-mkws-recid");
+ if (this.team.gotRecords()) {
+ that.team.fetchDetails(recid);
+ } else {
+ this.team.queue("firstrecords").subscribe(function() {
+ that.team.fetchDetails(recid);
+ });
+ }
+ this.team.queue("record").subscribe(function(data) {
+ console.log(data);
+ if ($.inArray(recid, data.recid) > -1) {
+ var template = that.team.loadTemplate(that.config.template || "Record");
+ that.node.html(template(data));
+ }
+ });
+ that.autosearch();
+});
mkws.registerWidgetType('Records', function() {
var that = this;
var hit = data.hits[i];
that.team.queue("record").publish(hit);
hit.detailLinkId = team.recordElementId(hit.recid[0]);
- hit.detailClick = "mkws.showDetails('" + team.name() + "', '" + hit.recid[0] + "');return false;"
+ hit.detailClick = "mkws.showDetails('" + team.name() + "', '" + hit.recid[0] + "');return false;";
hit.containerClass = "mkwsSummary mkwsTeam_" + team.name();
hit.containerClass += " " + hit.detailLinkId;
// ### At some point, we may be able to move the
if (hit.recid == team.currentRecordId()) {
if (team.currentRecordData()) {
hit.renderedDetails = team.renderDetails(team.currentRecordData());
- console.log(hit.renderedDetails);
}
}
}
mkws.registerWidgetType('Navi', function() {
var that = this;
var teamName = this.team.name();
- var M = mkws.M;
this.team.queue("navi").subscribe(function() {
var filters = that.team.filters();
- var text = "";
+ var output = {filters:[]};
filters.visitTargets(function(id, name) {
- if (text) text += " | ";
- text += M('source') + ': <a class="mkwsRemovable" href="#" onclick="mkws.delimitTarget(\'' + teamName +
- "', '" + id + "'" + ');return false;">' + name + '</a>';
+ var cur = {};
+ cur.facet = 'source';
+ cur.value = name;
+ cur.click = "mkws.delimitTarget('" + teamName + "', '" + id + "'); return false;";
+ output.filters.push(cur);
});
filters.visitFields(function(field, value) {
- if (text) text += " | ";
- text += M(field) + ': <a class="mkwsRemovable" href="#" onclick="mkws.delimitQuery(\'' + teamName +
- "', '" + field + "', '" + value + "'" +
- ');return false;">' + value + '</a>';
+ var cur = {};
+ cur.facet = field;
+ cur.value = value;
+ cur.click = "mkws.delimitQuery('" + teamName + "', '" + field + "', '" + value + "'" + ");return false;";
+ output.filters.push(cur);
});
- that.node.html(text);
+ var template = that.team.loadTemplate(that.config.template || "Navi");
+ that.node.html(template(output));
});
});
var that = this;
this.node.hide();
this.team.queue("stat").subscribe(function(data) {
- var template = this.team.loadTemplate(this.config.template || "Progress");
- this.node.html(template({
+ var template = that.team.loadTemplate(that.config.template || "Progress");
+ that.node.html(template({
done: data.clients - data.activeclients,
waiting: data.activeclients
}));
mkws.registerWidgetType('Button', function() {});
+})(mkws.$); // jQuery wrapper