← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~benji/launchpad/bug-750573-move-overlay into lp:launchpad

 

Benji York has proposed merging lp:~benji/launchpad/bug-750573-move-overlay into lp:launchpad.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #750567 in Launchpad itself: "Structural subscription overlay doesn't instantly disappear."
  https://bugs.launchpad.net/launchpad/+bug/750567
  Bug #750573 in Launchpad itself: "Structual subscription overlay should open closer to the top of the page."
  https://bugs.launchpad.net/launchpad/+bug/750573

For more details, see:
https://code.launchpad.net/~benji/launchpad/bug-750573-move-overlay/+merge/56999

This branch fixes bugs 750567 ("Structural subscription overlay doesn't instantly disappear.") and 750573 ("Since the overlay can get very long, it would be nice if it started out closer to the top of the page.").

The diff is so small that I don't think it needs much further explanation but feel free to ask for an elaboration.

It also fixes lots of lint that predates the branch.
-- 
https://code.launchpad.net/~benji/launchpad/bug-750573-move-overlay/+merge/56999
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~benji/launchpad/bug-750573-move-overlay into lp:launchpad.
=== modified file 'lib/lp/registry/javascript/structural-subscription.js'
--- lib/lp/registry/javascript/structural-subscription.js	2011-04-07 20:05:55 +0000
+++ lib/lp/registry/javascript/structural-subscription.js	2011-04-08 19:11:32 +0000
@@ -265,7 +265,7 @@
     description_node.ancestor('.subscription-filter').one('.filter-name')
         .empty()
         .appendChild(render_filter_title(filter_info, filter));
-};
+}
 
 /**
  * Handle the activation of the edit subscription link.
@@ -305,7 +305,6 @@
             '<h2 id="subscription-overlay-title">Add a mail subscription '+
             'for '+LP.cache.context.title + ' bugs</h2>',
         form_content: Y.one(overlay_id),
-        centered: true,
         visible: false,
         form_submit_button: submit_button,
         form_cancel_button: Y.Node.create(cancel_button_html),
@@ -317,13 +316,21 @@
             }
         }
     });
+    add_subscription_overlay.set('align', {
+        node:'#side-portlets',
+        points:[Y.WidgetPositionAlign.TR, Y.WidgetPositionAlign.TL]
+    });
     add_subscription_overlay.render(content_box_id);
+    Y.one('#subscription-overlay-title').scrollIntoView();
     setup_overlay_validators(add_subscription_overlay, overlay_id);
     // Prevent cruft from hanging around upon closing.
     function clean_up(e) {
-        var filter_wrapper = Y.one('#' + FILTER_WRAPPER);
-        filter_wrapper.hide();
-        collapse_node(filter_wrapper);
+        // Add a tiny delay so the overlay doesn't shrink before being hidden.
+        setTimeout(function () {
+            var filter_wrapper = Y.one('#' + FILTER_WRAPPER);
+            filter_wrapper.hide();
+            collapse_node(filter_wrapper);
+        }, 1);
     }
     add_subscription_overlay.get('form_cancel_button').on(
         'click', clean_up);
@@ -1187,11 +1194,11 @@
 function create_subscription_node(serial_id, subscription_data, filter_id) {
     var node = Y.Node.create(
         '<div style="margin-top: 2em; padding: 0 1em 1em 1em; '+
-            '      border: 1px solid #ddd;"></div>')
-        .set('id', 'subscription-'+serial_id.toString())
+            'border: 1px solid #ddd;"></div>')
+        .set('id', 'subscription-'+serial_id.toString());
     node.appendChild(Y.Node.create(
         '  <span style="float: left; margin-top: -0.6em; '+
-            '      padding: 0 1ex; background-color: #fff;"></a>'))
+            'background-color: #fff;"></a>'))
         .appendChild('<span>Subscriptions to </span>')
         .appendChild(Y.Node.create('<a></a>')
                      .set('href', subscription_data.target_url)
@@ -1216,7 +1223,7 @@
             filter;
         node.appendChild(create_filter_node(filter_id, filter_info, filter));
         filter_id += 1;
-    };
+    }
     return node;
 }
 
@@ -1386,7 +1393,7 @@
  * Get team information from the submitted form data.
  */
 function get_team_info(form_data) {
-    var is_team = (form_data.recipient[0] == "team");
+    var is_team = (form_data.recipient[0] === "team");
     var link, team, title, url;
     if (is_team) {
         link = form_data.team[0];
@@ -1403,7 +1410,8 @@
         is_team: is_team,
         link: link,
         title: title,
-        url: url}
+        url: url
+    };
 }
 
 /**
@@ -1411,12 +1419,12 @@
  */
 function get_target_info() {
     if (LP.cache.target_info !== undefined) {
-        return LP.cache.target_info
+        return LP.cache.target_info;
     } else {
         var info = LP.cache.subscription_info[0];
         return {
             title: info.target_title,
-            url: info.target_url}
+            url: info.target_url};
     }
 }
 
@@ -1471,7 +1479,7 @@
                     target_url: target_info.url,
                     target_title: target_info.title
                 };
-                LP.cache.subscription_info = [subscription_info]
+                LP.cache.subscription_info = [subscription_info];
 
                 subscriptions_list = create_subscription_node(
                     0, subscription_info, 0);
@@ -1495,8 +1503,9 @@
                 filter_info, filter_id, anim_node);
             Y.lazr.anim.green_flash({node: anim_node}).run();
         }
-    }
+    };
 }
+
 namespace._make_add_subscription_success_handler =
         make_add_subscription_success_handler;