Switch widget now generates it own HTML.
authorMike Taylor <mike@indexdata.com>
Mon, 28 Apr 2014 16:26:22 +0000 (17:26 +0100)
committerMike Taylor <mike@indexdata.com>
Mon, 28 Apr 2014 16:26:22 +0000 (17:26 +0100)
(For now it also generates a sub-widget, and we define that widget
type -- UpperCase -- too. That's just as a proof of concept. I'll
delete it in the next delta, but I want it in the VC history.)

src/mkws-widgets.js

index c677853..d360730 100644 (file)
@@ -332,3 +332,22 @@ mkws.registerWidgetType('Done', function() {
        $(that.node).html("Search complete: found " + n + " records");
     });
 });
+
+
+mkws.registerWidgetType('Switch', function() {
+    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> \
+<div class="mkwsUpperCase">foo</div>\
+');
+});
+
+
+mkws.registerWidgetType('UpperCase', function() {
+    var text = $(this.node).html();
+    $(this.node).html(text.toUpperCase());
+});
+
+