Each registerWidgetType invocation directly follows the function it
[mkws-moved-to-github.git] / src / mkws-widgets.js
index ade21d4..4bf7ec7 100644 (file)
@@ -28,10 +28,11 @@ function widget($, team, type, node) {
 
 
 // Functions follow for promoting the regular widget object into
-// widgets of specific types. These could be moved outside of the
-// widget object, or even into their own source files.
+// widgets of specific types. These could be moved into their own
+// source files.
 
-function promoteTargets() {
+
+function promoteToTargets() {
     var that = this;
     var M = mkws.M;
 
@@ -57,9 +58,10 @@ function promoteTargets() {
        subnode.html(table);
     });
 }
+mkws.registerWidgetType('Targets', promoteToTargets);
 
 
-function promoteStat() {
+function promoteToStat() {
     var that = this;
     var M = mkws.M;
 
@@ -73,9 +75,10 @@ function promoteStat() {
            '<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>');
     });
 }
+mkws.registerWidgetType('Stat', promoteToStat);
 
 
-function promoteTermlists() {
+function promoteToTermlists() {
     var that = this;
     var M = mkws.M;
 
@@ -138,9 +141,10 @@ function promoteTermlists() {
        }
     });
 }
+mkws.registerWidgetType('Termlists', promoteToTermlists);
 
 
-function promotePager() {
+function promoteToPager() {
     var that = this;
     var M = mkws.M;
 
@@ -202,9 +206,10 @@ function promotePager() {
        }
     });
 }                           
+mkws.registerWidgetType('Pager', promoteToPager);
 
 
-function promoteRecords() {
+function promoteToRecords() {
     var that = this;
     var team = this.team;
 
@@ -233,9 +238,10 @@ function promoteRecords() {
        }
     });
 }
+mkws.registerWidgetType('Records', promoteToRecords);
 
 
-function promoteNavi() {
+function promoteToNavi() {
     var that = this;
     var teamName = this.team.name();
     var M = mkws.M;
@@ -262,9 +268,10 @@ function promoteNavi() {
        $(that.node).html(text);
     });
 }
+mkws.registerWidgetType('Navi', promoteToNavi);
 
 
-function promoteSort() {
+function promoteToSort() {
     // It seems this and the Perpage widget doen't need to
     // subscribe to anything, since they produce events rather
     // than consuming them.
@@ -277,9 +284,10 @@ function promoteSort() {
        return false;
     });
 }
+mkws.registerWidgetType('Sort', promoteToSort);
 
 
-function promotePerpage() {
+function promoteToPerpage() {
     $(this.node).change(function() {
        this.team.set_perpage($(node).val());
        if (this.team.submitted()) {
@@ -289,14 +297,4 @@ function promotePerpage() {
        return false;
     });
 }
-
-mkws.registerWidgetType('Targets', promoteTargets);
-mkws.registerWidgetType('Stat', promoteStat);
-mkws.registerWidgetType('Termlists', promoteTermlists);
-mkws.registerWidgetType('Pager', promotePager);
-mkws.registerWidgetType('Records', promoteRecords);
-mkws.registerWidgetType('Navi', promoteNavi);
-mkws.registerWidgetType('Sort', promoteSort);
-mkws.registerWidgetType('Perpage', promotePerpage);
-
-
+mkws.registerWidgetType('Perpage', promoteToPerpage);