Rewrite the ReferenceUniverse widget as a one-liner using this.subwidget()
authorMike Taylor <mike@indexdata.com>
Fri, 16 May 2014 11:26:30 +0000 (12:26 +0100)
committerMike Taylor <mike@indexdata.com>
Fri, 16 May 2014 11:26:30 +0000 (12:26 +0100)
Fixes bug MKWS-190 ("Inheriting from widgets is tricky")

examples/htdocs/mkws-widget-ru.js

index 97db1a2..4b7054f 100644 (file)
@@ -2,10 +2,6 @@ mkws.registerWidgetType('ReferenceUniverse', function() {
     //this.team.config.service_proxy_auth = "http://mkws.indexdata.com/service-proxy/?command=auth&action=login&username=paratext&password=paratext_mkc";
     // this.team.config.perpage_default = 5;
     // this.team.config.sort_default = "position";
-    var teamClass = 'mkwsTeam_' + this.team.name();
-    var html = "<h2>Reference Universe results:</h2>\n";
-    html += '<div class="mkwsRecords ' + teamClass 
-            + '" autosearch="' + this.node.attr("autosearch")
-            + '" sort="position" perpage="5"></div>';
-    this.node.html(html);
+    this.node.html("<h2>Reference Universe results:</h2>\n" +
+                   this.subwidget('Records', { sort: 'position', perpage: 5 }));
 });