mkws.registerWidgetType('Done', function() {
var that = this;
-
this.team.queue("complete").subscribe(function(n) {
- that.node.html("Search complete: found " + n + " records");
+ var template = that.team.loadTemplate(that.config.template || "Done");
+ that.node.html(template({count: n}));
});
});
mkws.registerWidgetType('Switch', function() {
if (!this.config.show_switch) return;
var tname = this.team.name();
- this.node.html('\
-<a href="#" onclick="mkws.switchView(\'' + tname + '\', \'records\')">Records</a><span> \
-| \
-</span><a href="#" onclick="mkws.switchView(\'' + tname + '\', \'targets\')">Targets</a>');
+ var output = {};
+ output.recordClick = "mkws.switchView(\'" + tname + "\', \'records\')";
+ output.targetClick = "mkws.switchView(\'" + tname + "\', \'targets\')";
+ var template = this.team.loadTemplate(this.config.template || "Switch");
+ this.node.html(template(output));
this.hideWhenNarrow();
});
mkws.registerWidgetType('Search', function() {
- var tname = this.team.name();
- var M = mkws.M;
-
- this.node.html('\
-<form name="mkwsSearchForm" class="mkwsSearchForm mkwsTeam_' + tname + '" action="" >\
- <input class="mkwsQuery mkwsTeam_' + tname + '" type="text" size="' + this.config.query_width + '" />\
- <input class="mkwsButton mkwsTeam_' + tname + '" type="submit" value="' + M('Search') + '" />\
-</form>');
+ var output = {};
+ output.team = this.team.name();
+ output.queryWidth = this.config.query_width;
+ var template = this.team.loadTemplate(this.config.template || "Search");
+ this.node.html(template(output));
});
--- /dev/null
+{{!
+Search form
+
+team - MKWS team
+queryWidth - configured width for search box
+}}
+<form name="mkwsSearchForm" class="mkwsSearchForm mkwsTeam_{{team}}" action="">
+ <input class="mkwsQuery mkwsTeam_{{team}}" type="text" size="{{queryWidth}}">
+ <input class="mkwsButton mkwsTeam_{{team}}" type="submit" value="{{{mkws-translate "Search"}}}">
+</form>
+
--- /dev/null
+{{!
+Switch between record and target view
+
+recordClick - handler to switch to record view
+targetClick - handler to switch to target view
+}}
+<a href="#" onclick="{{{recordClick}}}">{{{mkws-translate "Records"}}}</a>
+<span>|</span>
+<a href="#" onclick="{{{targetClick}}}">{{{mkws-translate "Targets"}}}</a>