mode debugging in hazelnut, and depending on the global debug flag
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 2 Oct 2013 15:16:43 +0000 (17:16 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 2 Oct 2013 15:16:43 +0000 (17:16 +0200)
plugins/hazelnut/static/js/hazelnut.js

index c572d6a..48c8aaa 100644 (file)
@@ -8,7 +8,7 @@
 
     // TEMP
     var debug=false;
-    debug=true
+//    debug=true
 
     var Hazelnut = Plugin.extend({
 
             var checkbox_id = this.flat_id(this.id('checkbox', key_value));
             checkbox_id = '#' + checkbox_id;
             var element = $(checkbox_id, this.table.fnGetNodes());
-//         messages.debug("set_checkbox checked=" + checked + " id=" + checkbox_id + " matches=" + element.length);
+           if (debug) messages.debug("set_checkbox checked=" + checked + " id=" + checkbox_id + " matches=" + element.length);
             element.attr('checked', checked);
         },
 
         {
             if (this.received_all_query) {
                // if the 'all' query has been dealt with already we may turn on the checkbox
+               if (debug) messages.debug("turning on checkbox for record "+record[this.key]);
                 this.set_checkbox(record, true);
            } else {
                // otherwise we need to remember that and do it later on
+               if (debug) messages.debug ("Remembering record to check " + record[this.key]);
                 this.buffered_records_to_check.push(record);
-               console.log ("Remembering record to check " + record);
            }
         },
 
 
                 /* ... and check the ones specified in the resource list */
                 $.each(this.buffered_records_to_check, function(i, record) {
+                   if (debug) messages.debug ("delayed turning on checkbox " + i + " record= " + record);
                     self.set_checkbox(record, true);
                 });