Merge lp:~jcsackett/launchpad/diff-overlay-close into lp:launchpad

Proposed by j.c.sackett
Status: Merged
Approved by: Brad Crittenden
Approved revision: no longer in the source branch.
Merged at revision: 12627
Proposed branch: lp:~jcsackett/launchpad/diff-overlay-close
Merge into: lp:launchpad
Diff against target: 25 lines (+10/-0)
1 file modified
lib/lp/code/javascript/branchmergeproposal.diff.js (+10/-0)
To merge this branch: bzr merge lp:~jcsackett/launchpad/diff-overlay-close
Reviewer Review Type Date Requested Status
Brad Crittenden (community) code Approve
Review via email: mp+54032@code.launchpad.net

Commit message

[r=bac][bug=720122] Adds a close event handler to the diff overlay so the close button actually works.

Description of the change

Summary
=======

The diff overlay for merge proposals (as seen on the branch index or bug index page) has a close button that doesn't do anything. This just adds a simple close function to the overlay bound to the close button's click event.

Preimplementation
=================

Spoke with Deryck Hodge about the reason for the breakage and ways to fix it.

Implementation
==============
lib/lp/code/javascript/branchmergeproposal.diff.js
--------------------------------------------------
A click handler is bound to the close button that dismisses the diff overlay.

Tests
=====

There's not really a good test for this that I can see; we're testing a lot of interaction between things. Similarly, windmill tests are bad, because they suck, and we're not testing data back and forth between page and server. I'm at a loss. If my assumptions are wrong, call me out and I'll add tests.

QA
==

The diff overlay in the example in the bug should be dismissable via the close button.

To post a comment you must log in.
Revision history for this message
Brad Crittenden (bac) wrote :

Hi Jonathan,

Thanks for talking me through the semantics of Y.after. Totally unintuitive.

As we discussed, I think _dismissDiff is poorly named as it isn't doing the dismissal but is instead setting up the click handler to do the dismissing at the appropriate time.

I do note the dismiss button (X) is oddly located. Is that a function of PrettyOverlay?

I've never used the diff overlay before so I'm happy to have seen this branch and that you're making it work properly.

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/code/javascript/branchmergeproposal.diff.js'
2--- lib/lp/code/javascript/branchmergeproposal.diff.js 2011-02-24 00:23:04 +0000
3+++ lib/lp/code/javascript/branchmergeproposal.diff.js 2011-03-18 21:26:13 +0000
4@@ -24,12 +24,22 @@
5 */
6 var DiffOverlay = function() {
7 DiffOverlay.superclass.constructor.apply(this, arguments);
8+ Y.after(this._setupDismissDiff, this, 'syncUI')
9 };
10
11 Y.extend(DiffOverlay, Y.lazr.PrettyOverlay, {
12 bindUI: function() {
13 // call PrettyOverlay's bindUI
14 this.constructor.superclass.bindUI.call(this);
15+ },
16+
17+ _setupDismissDiff: function() {
18+ var cancel_icon = Y.one('.close-button');
19+
20+ // Setup a click handler to dismiss the diff overlay.
21+ cancel_icon.on('click', function(e) {
22+ Y.one('.yui3-diff-overlay').setStyle('display', 'none');
23+ });
24 }
25 });
26