← Back to team overview

launchpad-reviewers team mailing list archive

lp:~deryck/launchpad/kill-freakin-stupid-left-over-mochikit-bind into lp:launchpad

 

Deryck Hodge has proposed merging lp:~deryck/launchpad/kill-freakin-stupid-left-over-mochikit-bind into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~deryck/launchpad/kill-freakin-stupid-left-over-mochikit-bind/+merge/88337

comment.js relied on a global bind function that was not part of YUI.  Removing Mochikit exposed this error.  This is fixed with this branch.
-- 
https://code.launchpad.net/~deryck/launchpad/kill-freakin-stupid-left-over-mochikit-bind/+merge/88337
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~deryck/launchpad/kill-freakin-stupid-left-over-mochikit-bind into lp:launchpad.
=== modified file 'lib/lp/app/javascript/comment.js'
--- lib/lp/app/javascript/comment.js	2011-08-09 14:18:02 +0000
+++ lib/lp/app/javascript/comment.js	2012-01-12 10:45:53 +0000
@@ -20,11 +20,13 @@
      */
     initializer: function() {
         this.submit_button = this.get_submit();
-        this.comment_input = Y.one('[id="field.comment"]');
+        this.comment_input = Y.one(
+            'div#add-comment-form [id="field.comment"]');
         this.lp_client = new Y.lp.client.Launchpad();
         this.error_handler = new Y.lp.client.ErrorHandler();
-        this.error_handler.clearProgressUI = bind(this.clearProgressUI, this);
-        this.error_handler.showError = bind(function (error_msg) {
+        this.error_handler.clearProgressUI = Y.bind(
+            this.clearProgressUI, this);
+        this.error_handler.showError = Y.bind(function (error_msg) {
             Y.lp.app.errors.display_error(this.submit_button, error_msg);
         }, this);
         this.progress_message = Y.Node.create(
@@ -39,7 +41,7 @@
      * @method get_submit
      */
     get_submit: function(){
-        return Y.one('[id="field.actions.save"]');
+        return Y.one('div#add-comment-form input[id="field.actions.save"]');
     },
     /**
      * Implementation of Widget.renderUI.
@@ -86,9 +88,9 @@
             return;
         }
         this.activateProgressUI('Saving...');
-        this.post_comment(bind(function(message_entry) {
+        this.post_comment(Y.bind(function(message_entry) {
             this.get_comment_HTML(
-                message_entry, bind(this.insert_comment_HTML, this));
+                message_entry, Y.bind(this.insert_comment_HTML, this));
             this._add_comment_success();
         }, this));
     },
@@ -186,9 +188,9 @@
      * @method bindUI
      */
     bindUI: function(){
-        this.comment_input.on('keyup', bind(this.syncUI, this));
-        this.comment_input.on('mouseup', bind(this.syncUI, this));
-        this.submit_button.on('click', bind(this.add_comment, this));
+        this.comment_input.on('keyup', this.syncUI, this);
+        this.comment_input.on('mouseup', this.syncUI, this);
+        this.submit_button.on('click', this.add_comment, this);
     },
     /**
      * Implementation of Widget.syncUI: Update appearance according to state.
@@ -325,7 +327,7 @@
         window.scrollTo(0, Y.one('#add-comment').getY());
         this.lp_client.get(object_url, {
             on: {
-                success: bind(function(comment){
+                success: Y.bind(function(comment){
                     this.set_in_reply_to(comment);
                     this.clearProgressUI();
                     this.syncUI();
@@ -380,11 +382,11 @@
      */
     bindUI: function() {
         CodeReviewComment.superclass.bindUI.apply(this);
-        this.vote_input.on('keyup', bind(this.syncUI, this));
-        this.vote_input.on('change', bind(this.syncUI, this));
-        this.review_type.on('keyup', bind(this.syncUI, this));
-        this.review_type.on('mouseup', bind(this.syncUI, this));
-        Y.all('a.menu-link-reply').on('click', bind(this.reply_clicked, this));
+        this.vote_input.on('keyup', this.syncUI, this);
+        this.vote_input.on('change', this.syncUI, this);
+        this.review_type.on('keyup', this.syncUI, this);
+        this.review_type.on('mouseup', this.syncUI, this);
+        Y.all('a.menu-link-reply').on('click', this.reply_clicked, this);
     },
     /**
      * Implementation of Widget.syncUI: Update appearance according to state.

=== modified file 'lib/lp/app/javascript/extras/extras.js'
--- lib/lp/app/javascript/extras/extras.js	2011-08-05 09:23:53 +0000
+++ lib/lp/app/javascript/extras/extras.js	2012-01-12 10:45:53 +0000
@@ -10,8 +10,6 @@
 
 YUI.add('lp.extras', function(Y) {
 
-Y.log('loading lp.extras');
-
 var namespace = Y.namespace("lp.extras"),
     NodeList = Y.NodeList;
 

=== modified file 'lib/lp/app/javascript/foldables.js'
--- lib/lp/app/javascript/foldables.js	2012-01-10 17:23:23 +0000
+++ lib/lp/app/javascript/foldables.js	2012-01-12 10:45:53 +0000
@@ -46,7 +46,6 @@
         included.each(function (span, index, list) {
             if (span.hasClass('foldable-quoted')) {
                 var quoted_lines = span.all('br');
-                debugger;
                 if (quoted_lines && quoted_lines.size() <= 11) {
                     // We do not hide short quoted passages (12 lines) by
                     // default.

=== modified file 'lib/lp/app/javascript/tests/test_foldables.js'
--- lib/lp/app/javascript/tests/test_foldables.js	2012-01-10 17:36:29 +0000
+++ lib/lp/app/javascript/tests/test_foldables.js	2012-01-12 10:45:53 +0000
@@ -82,7 +82,6 @@
         },
 
         test_doesnt_hide_short: function () {
-            debugger;
             this._add_comment(quote_comment);
             Y.lp.app.foldables.activate();
             Y.Assert.isNull(Y.one('a'));