Add another Handlebars helper, "compare".
[mkws-moved-to-github.git] / src / mkws-widget-builder.js
index 6460b61..2ee3496 100644 (file)
@@ -1,29 +1,29 @@
-mkws.registerWidgetType('Builder', function() {
-    var that = this;
-    var team = this.team;
+mkws.registerWidgetType('builder', function() {
+  var that = this;
+  var team = this.team;
 
-    this.button = $('<button/>', {
-        type: 'button',
-        text: this.config.text || "Build!"
-    });
-    $(this.node).append(this.button);
-    this.button.click(function() {
-        var   query = team.widget('Query').value();
-        var    sort = team.widget('Sort').value();
-        var perpage = team.widget('Perpage').value();
+  var button = mkws.$('<button/>', {
+    type: 'button',
+    text: this.config.text || "Build!"
+  });
+  this.node.append(button);
+  button.click(function() {
+    var   query = team.widget('query').value();
+    var    sort = team.widget('sort').value();
+    var perpage = team.widget('per-page').value();
 
-        var html = ('<div class="mkwsRecords" ' +
-                    'autosearch="' + query + '" ' +
-                    'sort="' + sort + '" ' +
-                    'perpage="' + perpage + '"></div>');
-        var fn = that.callback || alert;
-        fn(html);
-    });
+    var html = ('<div class="mkws-records mkwsRecords" ' +
+                'autosearch="' + query + '" ' +
+                'sort="' + sort + '" ' +
+                'perpage="' + perpage + '"></div>');
+    var fn = that.callback || alert;
+    fn(html);
+  });
 });
 
-mkws.registerWidgetType('ConsoleBuilder', function() {
-    mkws.promotionFunction('Builder').call(this);    
-    this.callback = function(s) {
-        console.log("Generated widget: " + s);
-    }
+mkws.registerWidgetType('console-builder', function() {
+  mkws.promotionFunction('builder').call(this);
+  this.callback = function(s) {
+    that.info("generated widget: " + s);
+  }
 });