Merge lp:~deryck/lazr-js/choiceedit-select-fix-529049 into lp:lazr-js

Proposed by Deryck Hodge
Status: Merged
Approved by: Deryck Hodge
Approved revision: 170
Merged at revision: not available
Proposed branch: lp:~deryck/lazr-js/choiceedit-select-fix-529049
Merge into: lp:lazr-js
Diff against target: 23 lines (+9/-4)
1 file modified
src-js/lazrjs/choiceedit/choiceedit.js (+9/-4)
To merge this branch: bzr merge lp:~deryck/lazr-js/choiceedit-select-fix-529049
Reviewer Review Type Date Requested Status
Graham Binns (community) js Approve
Review via email: mp+20274@code.launchpad.net

Commit message

Do not assume there is a selected item for choiceedit.js.

To post a comment you must log in.
Revision history for this message
Deryck Hodge (deryck) wrote :

This branch fixes the choice edit widget to not assume there is a selected item. This fixes the "affects me too" widget on LP, which doesn't have a selected item by default.

Revision history for this message
Graham Binns (gmb) :
review: Approve (js)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src-js/lazrjs/choiceedit/choiceedit.js'
2--- src-js/lazrjs/choiceedit/choiceedit.js 2010-02-23 13:14:18 +0000
3+++ src-js/lazrjs/choiceedit/choiceedit.js 2010-02-27 16:56:18 +0000
4@@ -523,10 +523,15 @@
5 var boundingBox = this.get('boundingBox');
6 var selectedListItem = boundingBox.query('span.current');
7 valueX = this._mouseX - (boundingBox.get('offsetWidth') / 2);
8- valueY = (this._mouseY -
9- this.get("headerContent").get('offsetHeight') -
10- selectedListItem.get('offsetTop') -
11- (selectedListItem.get('offsetHeight') / 2));
12+ var valueY;
13+ if (Y.Lang.isValue(selectedListItem)) {
14+ valueY = (this._mouseY -
15+ this.get("headerContent").get('offsetHeight') -
16+ selectedListItem.get('offsetTop') -
17+ (selectedListItem.get('offsetHeight') / 2));
18+ } else {
19+ valueY = this._mouseY - (boundingBox.get('offsetHeight') / 2);
20+ }
21 if (valueX < 0) {
22 valueX = 0;
23 }

Subscribers

People subscribed via source and target branches