Merge lp:~mars/launchpad/yui-3final-upgrade into lp:launchpad/db-devel
- yui-3final-upgrade
- Merge into db-devel
Status: | Merged |
---|---|
Approved by: | Francis J. Lacoste |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~mars/launchpad/yui-3final-upgrade |
Merge into: | lp:launchpad/db-devel |
Diff against target: |
3382 lines (+631/-613) 56 files modified
Makefile (+9/-3) lib/canonical/launchpad/javascript/bugs/bug_tags_entry.js (+27/-28) lib/canonical/launchpad/javascript/bugs/bugtask-index.js (+104/-104) lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js (+26/-37) lib/canonical/launchpad/javascript/bugs/offical_bug_tags.js (+27/-27) lib/canonical/launchpad/javascript/bugs/subscriber.js (+10/-12) lib/canonical/launchpad/javascript/bugs/tests/test_me_too.js (+6/-6) lib/canonical/launchpad/javascript/bugs/tests/test_subscriber.js (+2/-2) lib/canonical/launchpad/javascript/client/client.js (+13/-8) lib/canonical/launchpad/javascript/code/branchlinks.js (+18/-21) lib/canonical/launchpad/javascript/code/branchstatus.js (+3/-3) lib/canonical/launchpad/javascript/code/branchsubscription.js (+13/-13) lib/canonical/launchpad/javascript/code/codereview.js (+7/-7) lib/canonical/launchpad/javascript/lp/calendar.js (+3/-3) lib/canonical/launchpad/javascript/lp/comment.js (+9/-9) lib/canonical/launchpad/javascript/lp/lp.js (+123/-125) lib/canonical/launchpad/javascript/lp/mapping.js (+5/-5) lib/canonical/launchpad/javascript/lp/picker.js (+4/-4) lib/canonical/launchpad/javascript/lp/tests/test_lp_collapsibles.js (+35/-35) lib/canonical/launchpad/javascript/registry/milestone_table.js (+1/-1) lib/canonical/launchpad/javascript/registry/milestoneoverlay.js (+2/-2) lib/canonical/launchpad/javascript/registry/tests/test_milestone_table.js (+4/-4) lib/canonical/launchpad/javascript/registry/tests/timeline.js (+14/-14) lib/canonical/launchpad/javascript/soyuz/archivesubscribers_index.js (+5/-5) lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js (+2/-2) lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js (+7/-7) lib/canonical/launchpad/javascript/soyuz/update_archive_build_statuses.js (+18/-20) lib/canonical/launchpad/javascript/translations/translations.js (+1/-1) lib/lp/app/templates/base-layout-macros.pt (+34/-4) lib/lp/app/templates/base-layout.pt (+1/-1) lib/lp/bugs/templates/bug-portlet-subscribers.pt (+1/-1) lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt (+4/-4) lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt (+4/-4) lib/lp/bugs/templates/bugtask-index.pt (+1/-1) lib/lp/code/templates/branch-import-details.pt (+1/-1) lib/lp/code/templates/branch-listing.pt (+1/-1) lib/lp/code/templates/branch-portlet-subscribers.pt (+1/-1) lib/lp/code/templates/branchmergeproposal-generic-listing.pt (+2/-2) lib/lp/registry/templates/distributionsourcepackage-index.pt (+2/-2) lib/lp/registry/templates/object-timeline-graph.pt (+2/-2) lib/lp/registry/templates/person-macros.pt (+1/-1) lib/lp/registry/templates/product-new.pt (+13/-13) lib/lp/registry/templates/productrelease-add-from-series.pt (+2/-2) lib/lp/registry/templates/teammembership-index.pt (+3/-3) lib/lp/registry/templates/timeline-macros.pt (+2/-2) lib/lp/soyuz/templates/archive-edit-dependencies.pt (+19/-26) lib/lp/soyuz/templates/archive-index.pt (+2/-2) lib/lp/soyuz/templates/archive-macros.pt (+3/-3) lib/lp/soyuz/templates/archive-packages.pt (+1/-1) lib/lp/soyuz/windmill/tests/test_archivesubscribersindex.py (+11/-8) lib/lp/translations/templates/object-templates.pt (+10/-12) lib/lp/translations/templates/pofile-export.pt (+3/-3) lib/lp/translations/templates/pofile-translate.pt (+3/-3) lib/lp/translations/templates/translationimportqueueentry-index.pt (+1/-1) setup.py (+2/-0) versions.cfg (+3/-1) |
To merge this branch: | bzr merge lp:~mars/launchpad/yui-3final-upgrade |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Francis J. Lacoste (community) | code | Approve | |
Review via email: mp+14838@code.launchpad.net |
Commit message
Description of the change
Māris Fogels (mars) wrote : | # |
Francis J. Lacoste (flacoste) wrote : | # |
On November 13, 2009, Māris Fogels wrote:
> Māris Fogels has proposed merging lp:~mars/launchpad/yui-3final-upgrade
> into lp:launchpad.
>
> Requested reviews:
> Canonical Launchpad Engineering (launchpad)
>
>
> Hi,
>
> This branch upgrades Launchpad's JavaScript from YUI 3 PR2 to YUI 3.0.0
> final.
>
> The branch has a few windmill errors, so it should not be merged quite yet.
> However, the diff is large, so it is probably in everyone's best interest
> to review it before it grows more.
>
> There are some changes to the underlying build system that need to be
> reverted before submission, such as the changes to setup.py, buildout.cfg,
> etc.
>
status approved
review approve code
Thanks a lot for this branch! It contains a lot of nice clean-ups and even a
bug fix!
Here are the few comments I have and we already discussed those live. So feel
free to land on db-devel once these are handled. We should do QA on staging
Monday and Tuesday, and if most of the things seem to work, let's land it on
devel Wednesday.
Cheers
--
Francis J. Lacoste
<email address hidden>
1 | > === modified file 'Makefile' |
2 | |
3 | > + # We absolutely do not want to include the testing module and its |
4 | > + # jsTestDriver test harness hacks. They fiddle with built-in functions! |
5 | > + ${SHHH} bin/jsbuild $(JSFLAGS) -b $(LAZR_BUILT_JS_ROOT) -x testing/ |
6 | |
7 | Please update this comment to make it obvious that this is excluded |
8 | from the _production roll-ups_. |
9 | |
10 | Also, once landed investigate if the jsTestDriver infrastructure can |
11 | still be used from within Launchpad to run unit tests. If that's not |
12 | the case, file a bug to fix it soon. |
13 | |
14 | > === modified file 'buildout.cfg' |
15 | > --- buildout.cfg 2009-10-26 13:49:11 +0000 |
16 | > +++ buildout.cfg 2009-11-13 15:45:29 +0000 |
17 | > @@ -16,7 +16,7 @@ |
18 | > # dependencies *other* than those in our download-cache. Once you have the |
19 | > # desired software, reenable this option (and check in the new software to |
20 | > # lp:lp-source-dependencies if this is going to be reviewed/merged/deployed.) |
21 | > -install-from-cache = true |
22 | > +#install-from-cache = true |
23 | > |
24 | > # This also will need to be temporarily disabled or changed for package |
25 | > # upgrades. Newly-added packages should also add their desired version number |
26 | |
27 | This should be reverted. |
28 | |
29 | > === modified file 'lib/canonical/launchpad/javascript/bugs/bugtask-index.js' |
30 | > + update_dupe_link.on('click', function(e){ |
31 | > // Only go ahead if we have received the form content by the |
32 | > // time the user clicks: |
33 | > if (duplicate_form_overlay){ |
34 | |
35 | Missing a space between function(e) and { |
36 | |
37 | |
38 | > === modified file 'versions.cfg' |
39 | > --- versions.cfg 2009-11-10 14:41:33 +0000 |
40 | > +++ versions.cfg 2009-11-13 15:45:29 +0000 |
41 | > @@ -32,8 +32,9 @@ |
42 | > lazr.restful = 0.9.17 |
43 | > lazr.restfulclient = 0.9.10 |
44 | > lazr.smtptest = 1.1 |
45 | > +lazr.testing = 0.1.1 |
46 | > lazr.uri = 1.0.2 |
47 | > -lazr-js = 0.9.1 |
48 | > +lazr-js = 0.9DEV |
49 | > martian = 0.11 |
50 | > mechanize = 0.1.7b |
51 | > mocker = 0.10.1 |
52 | > |
53 | |
54 | We'll need to add a sdist matching the correct larzr-js revision that we want |
55 | to use. |
Preview Diff
1 | === modified file 'Makefile' |
2 | --- Makefile 2009-11-17 13:14:18 +0000 |
3 | +++ Makefile 2009-11-18 13:45:26 +0000 |
4 | @@ -17,6 +17,7 @@ |
5 | |
6 | LPCONFIG=development |
7 | |
8 | +JSFLAGS= |
9 | LP_BUILT_JS_ROOT=lib/canonical/launchpad/icing/build |
10 | LAZR_BUILT_JS_ROOT=lazr-js/build |
11 | |
12 | @@ -124,12 +125,17 @@ |
13 | build: $(BZR_VERSION_INFO) compile apidoc jsbuild |
14 | |
15 | jsbuild_lazr: |
16 | - ${SHHH} bin/jsbuild -b lazr-js/build |
17 | + # We absolutely do not want to include the lazr.testing module and its |
18 | + # jsTestDriver test harness modifications in the lazr.js and launchpad.js |
19 | + # roll-up files. They fiddle with built-in functions! See Bug 482340. |
20 | + ${SHHH} bin/jsbuild $(JSFLAGS) -b $(LAZR_BUILT_JS_ROOT) -x testing/ |
21 | |
22 | jsbuild: jsbuild_lazr |
23 | ${SHHH} bin/jsbuild \ |
24 | - -n launchpad -s lib/canonical/launchpad/javascript \ |
25 | - -b lib/canonical/launchpad/icing/build \ |
26 | + $(JSFLAGS) \ |
27 | + -n launchpad \ |
28 | + -s lib/canonical/launchpad/javascript \ |
29 | + -b $(LP_BUILT_JS_ROOT) \ |
30 | lib/canonical/launchpad/icing/MochiKit.js \ |
31 | $(shell $(HERE)/utilities/yui-deps.py) \ |
32 | lib/canonical/launchpad/icing/lazr/build/lazr.js |
33 | |
34 | === added symlink 'lib/canonical/launchpad/icing/lazr' |
35 | === target is u'../../../../lazr-js' |
36 | === removed symlink 'lib/canonical/launchpad/icing/lazr' |
37 | === target was u'../../../../lazr-js' |
38 | === added symlink 'lib/canonical/launchpad/icing/yui' |
39 | === target is u'../../../../lazr-js/build/yui' |
40 | === removed symlink 'lib/canonical/launchpad/icing/yui' |
41 | === target was u'../../../../lazr-js/build/yui' |
42 | === modified file 'lib/canonical/launchpad/javascript/bugs/bug_tags_entry.js' |
43 | --- lib/canonical/launchpad/javascript/bugs/bug_tags_entry.js 2009-07-17 18:46:25 +0000 |
44 | +++ lib/canonical/launchpad/javascript/bugs/bug_tags_entry.js 2009-11-18 13:45:26 +0000 |
45 | @@ -42,12 +42,11 @@ |
46 | */ |
47 | var populate_tags_input = function() { |
48 | var tags = []; |
49 | - var anchors = tag_list_span.queryAll(A); |
50 | - if (anchors != null) { |
51 | - tag_list_span.queryAll(A).each(function(a) { |
52 | - tags.push(a.get(INNER_HTML)); |
53 | - }); |
54 | - } |
55 | + |
56 | + tag_list_span.all(A).each(function(anchor) { |
57 | + tags.push(anchor.get(INNER_HTML)); |
58 | + }); |
59 | + |
60 | tag_input.set(VALUE, tags.join(' ') + ' '); |
61 | }; |
62 | |
63 | @@ -68,7 +67,7 @@ |
64 | function(elem) { return elem != ''; }); |
65 | var bug = new LP.client.Entry( |
66 | lp_client, LP.client.cache[BUG], LP.client.cache[BUG].self_link); |
67 | - bug.removeAtt('http_etag'); |
68 | + bug.removeAttr('http_etag'); |
69 | bug.set('tags', tags); |
70 | tags_edit_spinner.setStyle(DISPLAY, INLINE); |
71 | ok_button.setStyle(DISPLAY, NONE); |
72 | @@ -104,10 +103,10 @@ |
73 | tags_edit_spinner.setStyle(DISPLAY, NONE); |
74 | Y.lazr.anim.green_flash({ node: tag_list_span }).run(); |
75 | if (Y.Lang.trim(tags_html) == '') { |
76 | - Y.get('#bug-tags').removeClass(TAGS_SHOW); |
77 | - Y.get('#bug-tags').addClass(TAGS_HIDE); |
78 | - Y.get('#add-bug-tags').removeClass(TAGS_HIDE); |
79 | - Y.get('#add-bug-tags').addClass(TAGS_SHOW); |
80 | + Y.one('#bug-tags').removeClass(TAGS_SHOW); |
81 | + Y.one('#bug-tags').addClass(TAGS_HIDE); |
82 | + Y.one('#add-bug-tags').removeClass(TAGS_HIDE); |
83 | + Y.one('#add-bug-tags').addClass(TAGS_SHOW); |
84 | } |
85 | }, |
86 | failure: function(id, request) { |
87 | @@ -132,10 +131,10 @@ |
88 | autocomplete.hide() |
89 | Y.lazr.anim.red_flash({ node: tag_list_span }).run(); |
90 | if (Y.Lang.trim(tag_list_span.get('innerHTML')) == '') { |
91 | - Y.get('#bug-tags').removeClass(TAGS_SHOW); |
92 | - Y.get('#bug-tags').addClass(TAGS_HIDE); |
93 | - Y.get('#add-bug-tags').removeClass(TAGS_HIDE); |
94 | - Y.get('#add-bug-tags').addClass(TAGS_SHOW); |
95 | + Y.one('#bug-tags').removeClass(TAGS_SHOW); |
96 | + Y.one('#bug-tags').addClass(TAGS_HIDE); |
97 | + Y.one('#add-bug-tags').removeClass(TAGS_HIDE); |
98 | + Y.one('#add-bug-tags').addClass(TAGS_SHOW); |
99 | } |
100 | }; |
101 | |
102 | @@ -164,15 +163,15 @@ |
103 | if (LP.client.links['me'] === undefined) { return; } |
104 | |
105 | available_tags = Y.Array(available_official_tags); |
106 | - bug_tags_div = Y.get('#bug-tags'); |
107 | - edit_tags_trigger = bug_tags_div.query('#edit-tags-trigger'); |
108 | - add_tags_trigger = Y.get('#add-tags-trigger'); |
109 | - tag_list_span = bug_tags_div.query('#tag-list'); |
110 | - tag_input = bug_tags_div.query('#tag-input'); |
111 | - ok_button = bug_tags_div.query('#edit-tags-ok'); |
112 | - cancel_button = bug_tags_div.query('#edit-tags-cancel'); |
113 | - tags_edit_spinner = bug_tags_div.query('#tags-edit-spinner'); |
114 | - tags_form = bug_tags_div.query('#tags-form'); |
115 | + bug_tags_div = Y.one('#bug-tags'); |
116 | + edit_tags_trigger = bug_tags_div.one('#edit-tags-trigger'); |
117 | + add_tags_trigger = Y.one('#add-tags-trigger'); |
118 | + tag_list_span = bug_tags_div.one('#tag-list'); |
119 | + tag_input = bug_tags_div.one('#tag-input'); |
120 | + ok_button = bug_tags_div.one('#edit-tags-ok'); |
121 | + cancel_button = bug_tags_div.one('#edit-tags-cancel'); |
122 | + tags_edit_spinner = bug_tags_div.one('#tags-edit-spinner'); |
123 | + tags_form = bug_tags_div.one('#tags-form'); |
124 | |
125 | edit_tags_trigger.on('click', function(e) { |
126 | e.halt(); |
127 | @@ -181,10 +180,10 @@ |
128 | |
129 | add_tags_trigger.on('click', function(e) { |
130 | e.halt(); |
131 | - Y.get('#bug-tags').removeClass(TAGS_HIDE); |
132 | - Y.get('#bug-tags').addClass(TAGS_SHOW); |
133 | - Y.get('#add-bug-tags').removeClass(TAGS_SHOW); |
134 | - Y.get('#add-bug-tags').addClass(TAGS_HIDE); |
135 | + Y.one('#bug-tags').removeClass(TAGS_HIDE); |
136 | + Y.one('#bug-tags').addClass(TAGS_SHOW); |
137 | + Y.one('#add-bug-tags').removeClass(TAGS_SHOW); |
138 | + Y.one('#add-bug-tags').addClass(TAGS_HIDE); |
139 | edit(); |
140 | }); |
141 | |
142 | |
143 | === modified file 'lib/canonical/launchpad/javascript/bugs/bugtask-index.js' |
144 | --- lib/canonical/launchpad/javascript/bugs/bugtask-index.js 2009-11-14 21:14:40 +0000 |
145 | +++ lib/canonical/launchpad/javascript/bugs/bugtask-index.js 2009-11-18 13:45:26 +0000 |
146 | @@ -85,21 +85,21 @@ |
147 | Y.bugs.portlet.subscribe('bugs:nameloaded', function(subscription) { |
148 | var error_handler = new LP.client.ErrorHandler(); |
149 | error_handler.clearProgressUI = function() { |
150 | - var temp_link = Y.get('#temp-username'); |
151 | + var temp_link = Y.one('#temp-username'); |
152 | if (temp_link) { |
153 | var temp_parent = temp_link.get('parentNode'); |
154 | temp_parent.removeChild(temp_link); |
155 | } |
156 | }; |
157 | error_handler.showError = function(error_msg) { |
158 | - Y.lp.display_error(Y.get('.menu-link-addsubscriber'), error_msg); |
159 | + Y.lp.display_error(Y.one('.menu-link-addsubscriber'), error_msg); |
160 | }; |
161 | |
162 | var config = { |
163 | on: { |
164 | success: function() { |
165 | - var temp_link = Y.get('#temp-username'); |
166 | - var temp_spinner = Y.get('#temp-name-spinner'); |
167 | + var temp_link = Y.one('#temp-username'); |
168 | + var temp_spinner = Y.one('#temp-name-spinner'); |
169 | temp_link.removeChild(temp_spinner); |
170 | var anim = Y.lazr.anim.green_flash({ node: temp_link }); |
171 | anim.on('end', function() { |
172 | @@ -136,17 +136,14 @@ |
173 | |
174 | setup_client_and_bug(); |
175 | |
176 | - // First look for 'Mark as duplicate' links. |
177 | - var update_dupe_links = Y.all('.menu-link-mark-dupe'); |
178 | - |
179 | - // If there are none, check for any 'change duplicate bug' links. |
180 | - if (!update_dupe_links){ |
181 | - update_dupe_links = Y.all('#change_duplicate_bug'); |
182 | - } |
183 | - |
184 | - if (update_dupe_links) { |
185 | + // Look for the 'Mark as duplicate' links or the |
186 | + // 'change duplicate bug' link. |
187 | + var update_dupe_link = Y.one( |
188 | + '.menu-link-mark-dupe, #change_duplicate_bug'); |
189 | + |
190 | + if (update_dupe_link) { |
191 | // First things first, pre-load the mark-dupe form. |
192 | - update_dupe_url = update_dupe_links.item(0).getAttribute('href'); |
193 | + update_dupe_url = update_dupe_link.get('href'); |
194 | var mark_dupe_form_url = update_dupe_url + '/++form++'; |
195 | |
196 | duplicate_form_overlay = new Y.lazr.FormOverlay({ |
197 | @@ -165,7 +162,7 @@ |
198 | |
199 | // Add an on-click handler to any links found that displays |
200 | // the form overlay. |
201 | - update_dupe_links.on('click', function(e){ |
202 | + update_dupe_link.on('click', function(e) { |
203 | // Only go ahead if we have received the form content by the |
204 | // time the user clicks: |
205 | if (duplicate_form_overlay){ |
206 | @@ -174,17 +171,17 @@ |
207 | } |
208 | }); |
209 | // Add a class denoting them as js-action links. |
210 | - update_dupe_links.addClass('js-action'); |
211 | + update_dupe_link.addClass('js-action'); |
212 | } |
213 | |
214 | - privacy_link = Y.get('#privacy-link'); |
215 | + privacy_link = Y.one('#privacy-link'); |
216 | |
217 | if (privacy_link) { |
218 | var privacy_link_url = privacy_link.getAttribute('href') + '/++form++'; |
219 | - var privacy_div = Y.get('#privacy-text'); |
220 | + var privacy_div = Y.one('#privacy-text'); |
221 | var privacy_html = privacy_link.get('innerHTML') + ' '; |
222 | privacy_div.set('innerHTML', privacy_html); |
223 | - var privacy_text = Y.get('#privacy-text'); |
224 | + var privacy_text = Y.one('#privacy-text'); |
225 | privacy_link = Y.Node.create( |
226 | '<a id="privacy-link" class="sprite edit" title="[edit]">' + |
227 | '<span class="invisible-link">edit</span></a>'); |
228 | @@ -210,7 +207,7 @@ |
229 | e.preventDefault(); |
230 | privacy_form_overlay.show(); |
231 | // XXX Abel Deuring 2009-04-23, bug 365462 |
232 | - // Y.get('#field.private') returns null. |
233 | + // Y.one('#field.private') returns null. |
234 | // Seems that YUI does not like IDs containing a '.' |
235 | document.getElementById('field.private').focus(); |
236 | } |
237 | @@ -230,7 +227,7 @@ |
238 | * @param e {Object} The event object. |
239 | */ |
240 | function clear_picker(e) { |
241 | - var input = Y.get('.yui-picker-search-box input'); |
242 | + var input = Y.one('.yui-picker-search-box input'); |
243 | input.set('value', ''); |
244 | this.set('error', ''); |
245 | this.set('results', [{}]); |
246 | @@ -258,7 +255,7 @@ |
247 | picker.on('save', clear_picker, picker); |
248 | picker.on('cancel', clear_picker, picker); |
249 | |
250 | - var subscription_link_someone_else = Y.get('.menu-link-addsubscriber'); |
251 | + var subscription_link_someone_else = Y.one('.menu-link-addsubscriber'); |
252 | subscription_link_someone_else.on('click', function(e) { |
253 | e.halt(); |
254 | picker.show(); |
255 | @@ -278,8 +275,8 @@ |
256 | |
257 | setup_client_and_bug(); |
258 | var subscription = new Y.lp.Subscription({ |
259 | - link: Y.get('.menu-link-subscription'), |
260 | - spinner: Y.get('#sub-unsub-spinner'), |
261 | + link: Y.one('.menu-link-subscription'), |
262 | + spinner: Y.one('#sub-unsub-spinner'), |
263 | subscriber: new Y.lp.Subscriber({ |
264 | uri: LP.client.links.me, |
265 | subscriber_ids: subscriber_ids |
266 | @@ -333,13 +330,11 @@ |
267 | subscriber_ids: subscriber_ids |
268 | }) |
269 | }); |
270 | - var unsubscribe_icons = Y.all('.unsub-icon'); |
271 | - if (unsubscribe_icons) { |
272 | - unsubscribe_icons.on('click', function(e) { |
273 | - e.halt(); |
274 | - unsubscribe_user_via_icon(e.target, subscription); |
275 | - }); |
276 | - } |
277 | + |
278 | + Y.on('click', function(e) { |
279 | + e.halt(); |
280 | + unsubscribe_user_via_icon(e.target, subscription); |
281 | + }, '.unsub-icon'); |
282 | } |
283 | |
284 | /* |
285 | @@ -371,13 +366,13 @@ |
286 | // subscribing can be done inline. Named operations |
287 | // don't return new objects, making the cached bug's |
288 | // etag invalid as well. |
289 | - lp_bug_entry.removeAtt('http_etag'); |
290 | + lp_bug_entry.removeAttr('http_etag'); |
291 | |
292 | // Hide the formoverlay: |
293 | duplicate_form_overlay.hide(); |
294 | |
295 | // Add the spinner... |
296 | - var dupe_span = Y.get('#mark-duplicate-text'); |
297 | + var dupe_span = Y.one('#mark-duplicate-text'); |
298 | dupe_span.addClass('update-in-progress-message'); |
299 | |
300 | // Set the new duplicate link on the bug entry. |
301 | @@ -403,22 +398,22 @@ |
302 | 'Duplicate of <a>bug #</a> ', |
303 | '<a class="menu-link-mark-dupe js-action sprite edit">', |
304 | '<span class="invisible-link">edit</span></a>'].join("")); |
305 | - dupe_span.queryAll('a').item(0) |
306 | + dupe_span.all('a').item(0) |
307 | .set('href', '/bugs/' + new_dup_id) |
308 | .appendChild(document.createTextNode(new_dup_id)); |
309 | - dupe_span.queryAll('a').item(1) |
310 | + dupe_span.all('a').item(1) |
311 | .set('href', update_dupe_url); |
312 | show_comment_on_duplicate_warning(); |
313 | } else { |
314 | dupe_span.set('innerHTML', [ |
315 | '<a class="menu-link-mark-dupe js-action ', |
316 | 'sprite bug-dupe">Mark as duplicate</a>'].join("")); |
317 | - dupe_span.query('a').set('href', update_dupe_url); |
318 | + dupe_span.one('a').set('href', update_dupe_url); |
319 | hide_comment_on_duplicate_warning(); |
320 | } |
321 | Y.lazr.anim.green_flash({node: dupe_span}).run(); |
322 | // ensure the new link is hooked up correctly: |
323 | - dupe_span.query('a.menu-link-mark-dupe').on( |
324 | + dupe_span.one('a.menu-link-mark-dupe').on( |
325 | 'click', function(e){ |
326 | e.preventDefault(); |
327 | duplicate_form_overlay.show(); |
328 | @@ -454,9 +449,9 @@ |
329 | * @method show_comment_on_duplicate_warning |
330 | */ |
331 | var show_comment_on_duplicate_warning = function() { |
332 | - var duplicate_warning = Y.get('#warning-comment-on-duplicate'); |
333 | + var duplicate_warning = Y.one('#warning-comment-on-duplicate'); |
334 | if (duplicate_warning === null) { |
335 | - var container = Y.get('#add-comment-form'); |
336 | + var container = Y.one('#add-comment-form'); |
337 | var first_node = container.get('firstChild'); |
338 | duplicate_warning = Y.Node.create( |
339 | ['<div class="warning message" id="warning-comment-on-duplicate">', |
340 | @@ -474,7 +469,7 @@ |
341 | * @method hide_comment_on_duplicate_warning |
342 | */ |
343 | var hide_comment_on_duplicate_warning = function() { |
344 | - var duplicate_warning = Y.get('#warning-comment-on-duplicate'); |
345 | + var duplicate_warning = Y.one('#warning-comment-on-duplicate'); |
346 | if (duplicate_warning !== null) { |
347 | duplicate_warning.ancestor().removeChild(duplicate_warning); |
348 | } |
349 | @@ -492,12 +487,12 @@ |
350 | // subscribing can be done inline. Named operations |
351 | // don't return new objects, making the cached bug's |
352 | // etag invalid as well. |
353 | - lp_bug_entry.removeAtt('http_etag'); |
354 | + lp_bug_entry.removeAttr('http_etag'); |
355 | |
356 | privacy_form_overlay.hide(); |
357 | |
358 | - var privacy_text = Y.get('#privacy-text'); |
359 | - var privacy_div = Y.get('#privacy'); |
360 | + var privacy_text = Y.one('#privacy-text'); |
361 | + var privacy_div = Y.one('#privacy'); |
362 | privacy_link.setStyle('display', 'none'); |
363 | privacy_spinner.setStyle('display', 'inline'); |
364 | |
365 | @@ -550,7 +545,7 @@ |
366 | privacy_text.appendChild(privacy_link); |
367 | privacy_text.appendChild(privacy_spinner); |
368 | |
369 | - var security_message = Y.get('#security-message'); |
370 | + var security_message = Y.one('#security-message'); |
371 | if (security_related) { |
372 | if (security_message === null) { |
373 | var security_message_html = [ |
374 | @@ -591,7 +586,7 @@ |
375 | link_branch_link.toggleClass('update-in-progress-message'); |
376 | }; |
377 | error_handler.showError = function(error_msg) { |
378 | - display_error(Y.get('.menu-link-addsubscriber'), error_msg); |
379 | + display_error(Y.one('.menu-link-addsubscriber'), error_msg); |
380 | }; |
381 | |
382 | function get_branch_and_link_to_bug(data) { |
383 | @@ -609,7 +604,7 @@ |
384 | } |
385 | |
386 | // Set up the picker itself. |
387 | - link_branch_link = Y.get('.menu-link-addbranch'); |
388 | + link_branch_link = Y.one('.menu-link-addbranch'); |
389 | if (Y.Lang.isValue(link_branch_link)) { |
390 | var config = { |
391 | header: 'Link a related branch', |
392 | @@ -642,7 +637,7 @@ |
393 | link_branch_link.toggleClass('update-in-progress-message'); |
394 | }; |
395 | error_handler.showError = function(error_msg) { |
396 | - display_error(Y.get('.menu-link-addsubscriber'), error_msg); |
397 | + display_error(Y.one('.menu-link-addsubscriber'), error_msg); |
398 | }; |
399 | |
400 | // Call linkBranch() on the bug. |
401 | @@ -683,21 +678,21 @@ |
402 | function add_branch_to_linked_branches(branch_html) { |
403 | var anim; |
404 | var bug_branch_node = Y.Node.create(branch_html); |
405 | - var bug_branch_list = Y.get('#bug-branches'); |
406 | + var bug_branch_list = Y.one('#bug-branches'); |
407 | if (!Y.Lang.isValue(bug_branch_list)) { |
408 | bug_branch_list = Y.Node.create( |
409 | '<div id="bug-branches">' + |
410 | ' <h2>Related branches</h2>' + |
411 | '</div>'); |
412 | |
413 | - var bug_branch_container = Y.get('#bug-branches-container'); |
414 | + var bug_branch_container = Y.one('#bug-branches-container'); |
415 | bug_branch_container.appendChild(bug_branch_list); |
416 | anim = Y.lazr.anim.green_flash({node: bug_branch_list}); |
417 | } else { |
418 | anim = Y.lazr.anim.green_flash({node: bug_branch_node}); |
419 | } |
420 | |
421 | - var existing_bug_branch_node = bug_branch_list.query( |
422 | + var existing_bug_branch_node = bug_branch_list.one( |
423 | '#' + bug_branch_node.getAttribute('id')); |
424 | if (!Y.Lang.isValue(existing_bug_branch_node)) { |
425 | // Only add the bug branch to the page if it isn't there |
426 | @@ -723,7 +718,7 @@ |
427 | // This should be parent_div.firstChild, but because of #text |
428 | // and cross-browser issues, using the YUI query syntax is |
429 | // safer here. |
430 | - var user_uri = parent_div.query('a').getAttribute('href'); |
431 | + var user_uri = parent_div.one('a').getAttribute('href'); |
432 | |
433 | // Strip the domain off. We just want a path. |
434 | var host_start = user_uri.indexOf('//'); |
435 | @@ -769,7 +764,7 @@ |
436 | var html = Y.Node.create('<div><a></a></div>'); |
437 | html.addClass(terms.css_name); |
438 | |
439 | - html.query('a') |
440 | + html.one('a') |
441 | .set('href', '/~' + terms.name) |
442 | .set('name', terms.full_name) |
443 | .set('title', 'Subscribed ' + terms.subscribed_by); |
444 | @@ -781,7 +776,7 @@ |
445 | span = '<span class="sprite person"></span>'; |
446 | } |
447 | |
448 | - html.query('a') |
449 | + html.one('a') |
450 | .appendChild(Y.Node.create(span)) |
451 | .appendChild(document.createTextNode(terms.display_name)); |
452 | |
453 | @@ -793,7 +788,7 @@ |
454 | icon_html |
455 | .set('id', 'unsubscribe-' + terms.css_name) |
456 | .set('title', 'Unsubscribe ' + terms.full_name); |
457 | - icon_html.query('img') |
458 | + icon_html.one('img') |
459 | .set('id', 'unsubscribe-icon-' + terms.css_name); |
460 | html.appendChild(icon_html); |
461 | } |
462 | @@ -834,15 +829,14 @@ |
463 | |
464 | // Use the list of subscribers pulled from the DOM to have sortable |
465 | // lists of unsubscribable vs. not unsubscribale person links. |
466 | - var subscribers = Y.get('#subscribers-links'); |
467 | - var all_subscribers = subscribers.queryAll('div'); |
468 | - if (Y.Lang.isValue(all_subscribers)) { |
469 | + var all_subscribers = Y.all('#subscribers-links div'); |
470 | + if (all_subscribers.size() > 0) { |
471 | all_subscribers.each(function(sub_link) { |
472 | if (sub_link.getAttribute('id') != 'temp-username') { |
473 | // User's displayname is found via the link's "name" attribute. |
474 | - var sub_link_name = sub_link.query('a').getAttribute('name'); |
475 | + var sub_link_name = sub_link.one('a').getAttribute('name'); |
476 | nodes_by_name[sub_link_name] = sub_link; |
477 | - if (sub_link.query('img.unsub-icon')) { |
478 | + if (sub_link.one('img.unsub-icon')) { |
479 | unsubscribables.push(sub_link_name); |
480 | } else { |
481 | not_unsubscribables.push(sub_link_name); |
482 | @@ -915,7 +909,7 @@ |
483 | function add_user_name_link(subscription) { |
484 | var person = subscription.get('person'); |
485 | var link_node = build_user_link_html(subscription); |
486 | - var subscribers = Y.get('#subscribers-links'); |
487 | + var subscribers = Y.one('#subscribers-links'); |
488 | if (subscription.is_current_user_subscribing()) { |
489 | // If this is the current user, then top post the name and be done. |
490 | subscribers.insertBefore(link_node, subscribers.get('firstChild')); |
491 | @@ -925,7 +919,7 @@ |
492 | subscribers.insertBefore(link_node, next); |
493 | } else { |
494 | // Handle the case of the displayed "None". |
495 | - var none_subscribers = Y.get('#none-subscribers'); |
496 | + var none_subscribers = Y.one('#none-subscribers'); |
497 | if (none_subscribers) { |
498 | var none_parent = none_subscribers.get('parentNode'); |
499 | none_parent.removeChild(none_subscribers); |
500 | @@ -936,7 +930,7 @@ |
501 | |
502 | // Set the click handler if adding a remove icon. |
503 | if (subscription.can_be_unsubscribed_by_user()) { |
504 | - var remove_icon = Y.get('#unsubscribe-icon-' + person.get('css_name')); |
505 | + var remove_icon = Y.one('#unsubscribe-icon-' + person.get('css_name')); |
506 | remove_icon.on('click', function(e) { |
507 | e.halt(); |
508 | unsubscribe_user_via_icon(e.target, subscription); |
509 | @@ -974,18 +968,18 @@ |
510 | ' <span>Other Display Name</span>', |
511 | ' <img id="temp-name-spinner" src="/@@/spinner" alt="" ', |
512 | ' style="position:absolute;right:8px" /></div>'].join('')); |
513 | - link_node.query('img').set('src', img_src); |
514 | + link_node.one('img').set('src', img_src); |
515 | link_node.replaceChild( |
516 | document.createTextNode(display_name), |
517 | - link_node.query('span')); |
518 | + link_node.one('span')); |
519 | |
520 | - var subscribers = Y.get('#subscribers-links'); |
521 | + var subscribers = Y.one('#subscribers-links'); |
522 | var next = get_next_subscriber_node(subscription); |
523 | if (next) { |
524 | subscribers.insertBefore(link_node, next); |
525 | } else { |
526 | // Handle the case of the displayed "None". |
527 | - var none_subscribers = Y.get('#none-subscribers'); |
528 | + var none_subscribers = Y.one('#none-subscribers'); |
529 | if (none_subscribers) { |
530 | var none_parent = none_subscribers.get('parentNode'); |
531 | none_parent.removeChild(none_subscribers); |
532 | @@ -1005,19 +999,19 @@ |
533 | * @method set_none_for_empty_subscribers |
534 | */ |
535 | function set_none_for_empty_subscribers() { |
536 | - var subscriber_list = Y.get('#subscribers-links'); |
537 | + var subscriber_list = Y.one('#subscribers-links'); |
538 | // Assume if subscriber_list has no child divs |
539 | // then the list of subscribers is empty. |
540 | - if (!Y.Lang.isValue(subscriber_list.query('div')) && |
541 | - !Y.Lang.isValue(Y.get('#none-subscribers'))) { |
542 | + if (!Y.Lang.isValue(subscriber_list.one('div')) && |
543 | + !Y.Lang.isValue(Y.one('#none-subscribers'))) { |
544 | var none_div = Y.Node.create('<div id="none-subscribers">None</div>'); |
545 | subscriber_list.appendChild(none_div); |
546 | } |
547 | |
548 | // Clear the empty duplicate subscribers list if it exists. |
549 | - var dup_list = Y.get('#subscribers-from-duplicates'); |
550 | + var dup_list = Y.one('#subscribers-from-duplicates'); |
551 | if (Y.Lang.isValue(dup_list) && |
552 | - !Y.Lang.isValue(dup_list.query('div'))) { |
553 | + !Y.Lang.isValue(dup_list.one('div'))) { |
554 | var parent = dup_list.get('parentNode'); |
555 | parent.removeChild(dup_list); |
556 | } |
557 | @@ -1088,7 +1082,7 @@ |
558 | error_handler.clearProgressUI = function () { |
559 | icon.set('src', '/@@/remove'); |
560 | // Grab the icon again to reset to click handler. |
561 | - var unsubscribe_icon = Y.get( |
562 | + var unsubscribe_icon = Y.one( |
563 | '#unsubscribe-icon-' + person.get('css_name')); |
564 | unsubscribe_icon.on('click', function(e) { |
565 | e.halt(); |
566 | @@ -1097,7 +1091,7 @@ |
567 | |
568 | }; |
569 | error_handler.showError = function (error_msg) { |
570 | - var flash_node = Y.get('.' + person.get('css_name')); |
571 | + var flash_node = Y.one('.' + person.get('css_name')); |
572 | Y.lp.display_error(flash_node, error_msg); |
573 | |
574 | }; |
575 | @@ -1111,7 +1105,7 @@ |
576 | anim.on('end', function(e) { |
577 | remove_user_name_link(icon_parent_div); |
578 | set_none_for_empty_subscribers(); |
579 | - var person_link = Y.get('.' + person.get('css_name')); |
580 | + var person_link = Y.one('.' + person.get('css_name')); |
581 | if (Y.Lang.isNull(person_link) && |
582 | subscription.is_current_user_subscribing()) { |
583 | // Current user has been completely unsubscribed. |
584 | @@ -1190,7 +1184,7 @@ |
585 | } |
586 | |
587 | // Handle the case where the subscriber's list displays "None". |
588 | - var empty_subscribers = Y.get("#none-subscribers"); |
589 | + var empty_subscribers = Y.one("#none-subscribers"); |
590 | if (empty_subscribers) { |
591 | var parent = empty_subscribers.get('parentNode'); |
592 | parent.removeChild(empty_subscribers); |
593 | @@ -1198,7 +1192,7 @@ |
594 | |
595 | add_user_name_link(subscription); |
596 | |
597 | - var flash_node = Y.get('.' + subscriber.get('css_name')); |
598 | + var flash_node = Y.one('.' + subscriber.get('css_name')); |
599 | var anim = Y.lazr.anim.green_flash({ node: flash_node }); |
600 | anim.run(); |
601 | }, |
602 | @@ -1258,7 +1252,7 @@ |
603 | subscription.set('has_dupes', false); |
604 | } |
605 | |
606 | - var flash_node = Y.get('.' + subscriber.get('css_name')); |
607 | + var flash_node = Y.one('.' + subscriber.get('css_name')); |
608 | var anim = Y.lazr.anim.green_flash({ node: flash_node }); |
609 | anim.on('end', function(e) { |
610 | remove_user_name_link(flash_node); |
611 | @@ -1291,12 +1285,18 @@ |
612 | return; |
613 | } |
614 | |
615 | - var tr = Y.get('#' + conf.row_id); |
616 | - var bugtarget_content = Y.get('#bugtarget-picker-' + conf.row_id); |
617 | - var status_content = tr.query('.status-content'); |
618 | - var importance_content = tr.query('.importance-content'); |
619 | - var assignee_content = Y.get('#assignee-picker-' + conf.row_id); |
620 | - var milestone_content = tr.query('.milestone-content'); |
621 | + var tr = Y.one('#' + conf.row_id); |
622 | + var bugtarget_content = Y.one('#bugtarget-picker-' + conf.row_id); |
623 | + var status_content = tr.one('.status-content'); |
624 | + var importance_content = tr.one('.importance-content'); |
625 | + var assignee_content = Y.one('#assignee-picker-' + conf.row_id); |
626 | + var milestone_content = tr.one('.milestone-content'); |
627 | + |
628 | + if (status_content === null) { |
629 | + // Not all table rows have status widgets. If this is one of those |
630 | + // rows, then bail. |
631 | + return; |
632 | + } |
633 | |
634 | if (Y.Lang.isValue(LP.client.cache.bug) && |
635 | Y.Lang.isValue(LP.client.cache.bug.duplicate_of_link)) { |
636 | @@ -1316,7 +1316,7 @@ |
637 | Y.DOM.create( |
638 | '<a href="+editstatus" ' + |
639 | ' class="sprite edit yui-activator-act" />'), |
640 | - bugtarget_content.query('.yui-activator-act')); |
641 | + bugtarget_content.one('.yui-activator-act')); |
642 | } else { |
643 | var bugtarget_picker = Y.lp.picker.addPickerPatcher( |
644 | 'Product', |
645 | @@ -1354,7 +1354,7 @@ |
646 | }); |
647 | // Set the inline form control's value, so that submitting |
648 | // it won't override the value we just set. |
649 | - Y.get(document.getElementById(conf.prefix + '.status')).set( |
650 | + Y.one(document.getElementById(conf.prefix + '.status')).set( |
651 | 'value', status_choice_edit.get('value')); |
652 | }); |
653 | status_choice_edit.plug({ |
654 | @@ -1386,7 +1386,7 @@ |
655 | }); |
656 | // Set the inline form control's value, so that submitting |
657 | // it won't override the value we just set. |
658 | - Y.get(document.getElementById(conf.prefix + '.importance')).set( |
659 | + Y.one(document.getElementById(conf.prefix + '.importance')).set( |
660 | 'value', importance_choice_edit.get('value')); |
661 | }); |
662 | importance_choice_edit.plug({ |
663 | @@ -1422,18 +1422,18 @@ |
664 | // to have a more established way of getting the web URL of |
665 | // an API object. Once such a solution is available we should |
666 | // fix this. |
667 | - milestone_content.query('.value').setAttribute( |
668 | + milestone_content.one('.value').setAttribute( |
669 | 'href', new_value.replace('/api/beta', '')); |
670 | } |
671 | // Set the inline form control's value, so that submitting |
672 | // it won't override the value we just set. |
673 | - var inline_combo = Y.get( |
674 | + var inline_combo = Y.one( |
675 | document.getElementById(conf.prefix + '.milestone')); |
676 | if (Y.Lang.isValue(inline_combo)) { |
677 | inline_combo.set('value', null); |
678 | Y.Array.each(milestone_choice_edit.get('items'), function(item) { |
679 | if (item.value == milestone_choice_edit.get('value')) { |
680 | - inline_combo.queryAll('option').each(function(opt) { |
681 | + inline_combo.all('option').each(function(opt) { |
682 | if (opt.get('innerHTML') == item.name) { |
683 | opt.set('selected', true); |
684 | } |
685 | @@ -1444,11 +1444,11 @@ |
686 | // Force redrawing the UI |
687 | milestone_choice_edit._uiClearWaiting(); |
688 | }); |
689 | - milestone_content.query('.nulltext').on( |
690 | + milestone_content.one('.nulltext').on( |
691 | 'mousedown', |
692 | milestone_choice_edit._onMouseDown, |
693 | milestone_choice_edit); |
694 | - milestone_choice_edit.render(); |
695 | + milestone_choice_edit.render(); |
696 | } |
697 | if (Y.Lang.isValue(assignee_content)) { |
698 | var assignee_picker = Y.lp.picker.addPickerPatcher( |
699 | @@ -1480,7 +1480,7 @@ |
700 | if (Y.UA.ie) { |
701 | return; |
702 | } |
703 | - var me_too_content = Y.get('#affectsmetoo'); |
704 | + var me_too_content = Y.one('#affectsmetoo'); |
705 | var me_too_edit = new MeTooChoiceSource({ |
706 | contentBox: me_too_content, value: user_is_affected, |
707 | elementToFlash: me_too_content, |
708 | @@ -1541,7 +1541,7 @@ |
709 | * affected by the current bug. Should be automatically calculated |
710 | * by HTML_PARSER. |
711 | * |
712 | - * Setter function returns Y.get(parameter) so that you can pass |
713 | + * Setter function returns Y.one(parameter) so that you can pass |
714 | * either a Node (as expected) or a selector. |
715 | * |
716 | * @attribute value_location |
717 | @@ -1550,7 +1550,7 @@ |
718 | flame_icon: { |
719 | value: null, |
720 | set: function(v) { |
721 | - return Y.get(v); |
722 | + return Y.one(v); |
723 | } |
724 | } |
725 | }; |
726 | @@ -1589,8 +1589,8 @@ |
727 | // Force the ChoiceSource to be rendered inline. |
728 | this.get('boundingBox').setStyle('display', 'inline'); |
729 | // Hide the static content and show the dynamic content. |
730 | - this.get('contentBox').query('.static').addClass('unseen'); |
731 | - this.get('contentBox').query('.dynamic').removeClass('unseen'); |
732 | + this.get('contentBox').one('.static').addClass('unseen'); |
733 | + this.get('contentBox').one('.dynamic').removeClass('unseen'); |
734 | }, |
735 | |
736 | _saveData: function() { |
737 | @@ -1634,7 +1634,7 @@ |
738 | function check_can_be_unsubscribed(subscription) { |
739 | var error_handler = new LP.client.ErrorHandler(); |
740 | error_handler.showError = function (error_msg) { |
741 | - Y.lp.display_error(Y.get('.menu-link-addsubscriber'), error_msg); |
742 | + Y.lp.display_error(Y.one('.menu-link-addsubscriber'), error_msg); |
743 | }; |
744 | |
745 | var config = { |
746 | @@ -1703,7 +1703,7 @@ |
747 | |
748 | var error_handler = new LP.client.ErrorHandler(); |
749 | error_handler.showError = function(error_msg) { |
750 | - Y.lp.display_error(Y.get('.menu-link-addsubscriber'), error_msg); |
751 | + Y.lp.display_error(Y.one('.menu-link-addsubscriber'), error_msg); |
752 | }; |
753 | |
754 | if (subscription.is_already_subscribed()) { |
755 | @@ -1722,9 +1722,9 @@ |
756 | * @method setup_add_attachment |
757 | */ |
758 | function setup_add_attachment() { |
759 | - var attachment_link = Y.get('.menu-link-addcomment'); |
760 | + var attachment_link = Y.one('.menu-link-addcomment'); |
761 | attachment_link.on('click', function(e) { |
762 | - var comment_input = Y.get('[id="field.comment"]'); |
763 | + var comment_input = Y.one('[id="field.comment"]'); |
764 | if (comment_input.get('value') !== '') { |
765 | var current_url = attachment_link.getAttribute('href'); |
766 | var attachment_url = current_url + '?field.comment=' + |
767 | @@ -1779,10 +1779,10 @@ |
768 | return null; |
769 | } |
770 | |
771 | - Y.get('#subscribers-portlet-spinner').setStyle('display', 'block'); |
772 | + Y.one('#subscribers-portlet-spinner').setStyle('display', 'block'); |
773 | |
774 | function hide_spinner() { |
775 | - Y.get('#subscribers-portlet-spinner').setStyle('display', 'none'); |
776 | + Y.one('#subscribers-portlet-spinner').setStyle('display', 'none'); |
777 | // Fire a custom event to notify that the initial click |
778 | // handler on subscription_link set above should be |
779 | // cleared. |
780 | @@ -1794,7 +1794,7 @@ |
781 | |
782 | function on_success(transactionid, response, args) { |
783 | hide_spinner(); |
784 | - var portlet = Y.get('#portlet-subscribers'); |
785 | + var portlet = Y.one('#portlet-subscribers'); |
786 | portlet.set('innerHTML', |
787 | portlet.get('innerHTML') + response.responseText); |
788 | |
789 | @@ -1805,7 +1805,7 @@ |
790 | |
791 | var config = {on: {success: on_success, |
792 | failure: hide_spinner}}; |
793 | - var url = Y.get( |
794 | + var url = Y.one( |
795 | '#subscribers-content-link').getAttribute('href').replace('bugs.', ''); |
796 | Y.io(url, config); |
797 | }; |
798 | |
799 | === modified file 'lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js' |
800 | --- lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js 2009-07-22 16:42:10 +0000 |
801 | +++ lib/canonical/launchpad/javascript/bugs/filebug-dupefinder.js 2009-11-18 13:45:26 +0000 |
802 | @@ -46,7 +46,7 @@ |
803 | */ |
804 | function get_details_div(expander) { |
805 | var details_div = expander.get( |
806 | - 'parentNode').get('parentNode').query('.duplicate-details'); |
807 | + 'parentNode').get('parentNode').one('.duplicate-details'); |
808 | |
809 | // Check that the details_div actually exists and raise an error if |
810 | // we can't find it. |
811 | @@ -77,24 +77,24 @@ |
812 | */ |
813 | function show_bug_reporting_form(e) { |
814 | // Collapse all the duplicate-details divs. |
815 | - Y.each(bug_already_reported_expanders, function(expander) { |
816 | + bug_already_reported_expanders.each(function(expander) { |
817 | collapse_bug_details(expander); |
818 | }); |
819 | |
820 | // Show the bug reporting form. |
821 | bug_reporting_form.setStyle(DISPLAY, BLOCK); |
822 | - Y.get(Y.DOM.byId('field.actions.submit_bug')).focus(); |
823 | + Y.one(Y.DOM.byId('field.actions.submit_bug')).focus(); |
824 | window.location.href = '#form-start'; |
825 | |
826 | // Focus the relevant elements of the form based on |
827 | // whether the package drop-down is displayed. |
828 | - var bugtarget_package_btn = Y.get( |
829 | + var bugtarget_package_btn = Y.one( |
830 | Y.DOM.byId('field.bugtarget.option.package')); |
831 | if (bugtarget_package_btn !== null && |
832 | bugtarget_package_btn !== undefined) { |
833 | - Y.get(Y.DOM.byId('field.bugtarget.package')).focus(); |
834 | + Y.one(Y.DOM.byId('field.bugtarget.package')).focus(); |
835 | } else { |
836 | - Y.get(Y.DOM.byId('field.comment')).focus(); |
837 | + Y.one(Y.DOM.byId('field.comment')).focus(); |
838 | } |
839 | } |
840 | |
841 | @@ -106,9 +106,9 @@ |
842 | */ |
843 | function create_subscribe_overlay(form) { |
844 | // Grab the bug id and title from the "Yes, this is my bug" form. |
845 | - var bug_id = form.query( |
846 | + var bug_id = form.one( |
847 | 'input.bug-already-reported-as').get('value'); |
848 | - var bug_title = Y.get('#bug-' + bug_id + '-title').get('innerHTML'); |
849 | + var bug_title = Y.one('#bug-' + bug_id + '-title').get('innerHTML'); |
850 | |
851 | if (bug_title.length > 35) { |
852 | // Truncate the bug title if it's more than 30 characters long. |
853 | @@ -161,25 +161,16 @@ |
854 | |
855 | // Add an on-click handler to the radio buttons to ensure that their |
856 | // labels' styles are set correctly when they're selected. |
857 | - var radio_buttons = form.queryAll('input.subscribe-option'); |
858 | - if (radio_buttons !== null && radio_buttons !== undefined) { |
859 | + var radio_buttons = form.all('input.subscribe-option'); |
860 | + radio_buttons.on('click', function(e) { |
861 | + // Loop over the radio buttons and set their parent |
862 | + // div's font-weight depending on whether they're |
863 | + // checked or not. |
864 | Y.each(radio_buttons, function(radio_button) { |
865 | - radio_button.on('click', function(e) { |
866 | - // Loop over the radio buttons and set their parent |
867 | - // div's font-weight depending on whether they're |
868 | - // checked or not. |
869 | - Y.each(radio_buttons, function(radio_button) { |
870 | - if (radio_button.get('checked')) { |
871 | - radio_button.get( |
872 | - 'parentNode').setStyle('fontWeight', 'bold'); |
873 | - } else { |
874 | - radio_button.get( |
875 | - 'parentNode').setStyle('fontWeight', 'normal'); |
876 | - } |
877 | - }); |
878 | - }); |
879 | + var weight = radio_button.get('checked') ? 'bold' : 'normal'; |
880 | + radio_button.get('parentNode').setStyle('fontWeight', weight); |
881 | }); |
882 | - } |
883 | + }); |
884 | |
885 | return subscribe_form_overlay; |
886 | } |
887 | @@ -189,17 +180,16 @@ |
888 | Y.on('domready', function() { |
889 | bug_already_reported_expanders = Y.all( |
890 | 'img.bug-already-reported-expander'); |
891 | - bug_reporting_form = Y.get('#bug_reporting_form'); |
892 | + bug_reporting_form = Y.one('#bug_reporting_form'); |
893 | |
894 | - if (bug_already_reported_expanders !== null && |
895 | - bug_already_reported_expanders !== undefined) { |
896 | + if (bug_already_reported_expanders.size() !== 0) { |
897 | |
898 | // Set up the onclick handlers for the expanders. |
899 | - Y.each(Y.all('.similar-bug'), function(row) { |
900 | - var bug_details_div = row.query('div.duplicate-details'); |
901 | - var image = row.query('img.bug-already-reported-expander'); |
902 | - var bug_title_link = row.query('.duplicate-bug-link'); |
903 | - var view_bug_link = row.query('.view-bug-link'); |
904 | + Y.all('.similar-bug').each(function(row) { |
905 | + var bug_details_div = row.one('div.duplicate-details'); |
906 | + var image = row.one('img.bug-already-reported-expander'); |
907 | + var bug_title_link = row.one('.duplicate-bug-link'); |
908 | + var view_bug_link = row.one('.view-bug-link'); |
909 | |
910 | // Grab the initial height of the element and create a |
911 | // config for the slide_out animation. This allows us to |
912 | @@ -276,13 +266,13 @@ |
913 | |
914 | // Collapse all the details divs, since we don't want them |
915 | // expanded first up. |
916 | - Y.each(Y.all('div.duplicate-details'), function(div) { |
917 | + Y.all('div.duplicate-details').each(function(div) { |
918 | collapse_bug_details(div); |
919 | }); |
920 | |
921 | } |
922 | |
923 | - bug_not_reported_button = Y.get('#bug-not-already-reported'); |
924 | + bug_not_reported_button = Y.one('#bug-not-already-reported'); |
925 | if (bug_not_reported_button !== null && |
926 | bug_not_reported_button !== undefined) { |
927 | // The bug_not_reported_button won't show up if there aren't any |
928 | @@ -291,8 +281,7 @@ |
929 | } |
930 | |
931 | // Attach the form overlay to the "Yes, this is my bug" forms. |
932 | - var this_is_my_bug_forms = Y.all('form.this-is-my-bug-form'); |
933 | - Y.each(this_is_my_bug_forms, function(form) { |
934 | + Y.all('form.this-is-my-bug-form').each(function(form) { |
935 | var subscribe_form_overlay = create_subscribe_overlay(form); |
936 | |
937 | form.on('submit', function(e) { |
938 | |
939 | === modified file 'lib/canonical/launchpad/javascript/bugs/offical_bug_tags.js' |
940 | --- lib/canonical/launchpad/javascript/bugs/offical_bug_tags.js 2009-06-30 21:06:27 +0000 |
941 | +++ lib/canonical/launchpad/javascript/bugs/offical_bug_tags.js 2009-11-18 13:45:26 +0000 |
942 | @@ -129,8 +129,8 @@ |
943 | other_cbs_checked = other_cbs_checked || cb.get('checked'); |
944 | }); |
945 | } |
946 | - Y.get('#remove-official-tags').set('disabled', !official_cbs_checked); |
947 | - Y.get('#add-official-tags').set('disabled', !other_cbs_checked); |
948 | + Y.one('#remove-official-tags').set('disabled', !official_cbs_checked); |
949 | + Y.one('#add-official-tags').set('disabled', !other_cbs_checked); |
950 | }; |
951 | |
952 | /** |
953 | @@ -158,9 +158,9 @@ |
954 | item); |
955 | var li_node = Y.Node.create(li_html); |
956 | li_node._tag = item; |
957 | - li_node.query('input').on('click', function(e) { |
958 | + li_node.one('input').on('click', function(e) { |
959 | enable_arrows(); |
960 | - var cb_node = li_node.query('input'); |
961 | + var cb_node = li_node.one('input'); |
962 | if (cb_node.get('checked')) { |
963 | li_node.addClass('selected'); |
964 | } else { |
965 | @@ -179,8 +179,8 @@ |
966 | * @method render_tag_lists |
967 | */ |
968 | var render_tag_lists = function() { |
969 | - var official_tags_ul = Y.get('#official-tags-list'); |
970 | - var other_tags_ul = Y.get('#other-tags-list'); |
971 | + var official_tags_ul = Y.one('#official-tags-list'); |
972 | + var other_tags_ul = Y.one('#other-tags-list'); |
973 | |
974 | official_tags_ul.set('innerHTML', ''); |
975 | other_tags_ul.set('innerHTML', ''); |
976 | @@ -207,8 +207,8 @@ |
977 | Y.each(official_tags, function(item) { |
978 | tags.push(item.tag); |
979 | }); |
980 | - Y.get('#field-official_bug_tags').set('value', tags.join(' ')); |
981 | - Y.get('#save-form').submit(); |
982 | + Y.one('#field-official_bug_tags').set('value', tags.join(' ')); |
983 | + Y.one('#save-form').submit(); |
984 | }; |
985 | |
986 | /** |
987 | @@ -219,8 +219,8 @@ |
988 | */ |
989 | var get_selected_tags = function(tags_ul) { |
990 | var selected_tags = []; |
991 | - tags_ul.queryAll('li').each(function(li) { |
992 | - if (li.query('input').get('checked')) { |
993 | + tags_ul.all('li').each(function(li) { |
994 | + if (li.one('input').get('checked')) { |
995 | selected_tags.push(li._tag); |
996 | } |
997 | }); |
998 | @@ -276,7 +276,7 @@ |
999 | * @method on_new_tag_add |
1000 | */ |
1001 | var on_new_tag_add = function() { |
1002 | - var new_tag = Y.Lang.trim(Y.get('#new-tag-text').get('value')); |
1003 | + var new_tag = Y.Lang.trim(Y.one('#new-tag-text').get('value')); |
1004 | var new_tag_already_official = false; |
1005 | Y.each(official_tags, function(item) { |
1006 | new_tag_already_official = ( |
1007 | @@ -305,9 +305,9 @@ |
1008 | } |
1009 | official_tags.push({tag: new_tag, count: 0}); |
1010 | sort_tags(official_tags); |
1011 | - Y.get('#new-tag-text').set('value', ''); |
1012 | - Y.get('#new-tag-add').set('disabled', true); |
1013 | - Y.get('#save-button').set('disabled', false); |
1014 | + Y.one('#new-tag-text').set('value', ''); |
1015 | + Y.one('#new-tag-add').set('disabled', true); |
1016 | + Y.one('#save-button').set('disabled', false); |
1017 | } else { |
1018 | display_error(); |
1019 | } |
1020 | @@ -330,7 +330,7 @@ |
1021 | * @method display_error |
1022 | */ |
1023 | var display_error = function() { |
1024 | - var new_tag = Y.get('#new-tag-text').get( |
1025 | + var new_tag = Y.one('#new-tag-text').get( |
1026 | 'value').replace(new RegExp('<', 'g'), '<'); |
1027 | var overlay = new Y.lazr.PrettyOverlay({ |
1028 | headerContent: '<span class="official-tag-error-message-header">' + |
1029 | @@ -356,56 +356,56 @@ |
1030 | official_tags = get_official_bug_tags(official_bug_tags); |
1031 | other_tags = get_other_bug_tags(used_bug_tags); |
1032 | |
1033 | - var layout_table = Y.get('#layout-table'); |
1034 | + var layout_table = Y.one('#layout-table'); |
1035 | |
1036 | // The entire dynamic UI is hidden initially, so that clients |
1037 | // with no JS don't display it. |
1038 | layout_table.setStyle('display', 'block'); |
1039 | |
1040 | - var official_tags_ul = Y.get('#official-tags-list'); |
1041 | - var other_tags_ul = Y.get('#other-tags-list'); |
1042 | + var official_tags_ul = Y.one('#official-tags-list'); |
1043 | + var other_tags_ul = Y.one('#other-tags-list'); |
1044 | |
1045 | render_tag_lists(); |
1046 | |
1047 | // Hook an event handler to the arrow button for moving |
1048 | // tags from the list of unofficial tags to the list of official tags. |
1049 | - Y.get('#add-official-tags').on('click', function(e) { |
1050 | + Y.one('#add-official-tags').on('click', function(e) { |
1051 | var updated_tags = get_updated_tags( |
1052 | other_tags_ul, other_tags, official_tags); |
1053 | other_tags = updated_tags.from_tags; |
1054 | official_tags = updated_tags.to_tags; |
1055 | render_tag_lists(); |
1056 | enable_arrows(); |
1057 | - Y.get('#save-button').set('disabled', false); |
1058 | + Y.one('#save-button').set('disabled', false); |
1059 | }); |
1060 | |
1061 | // Hook an event handler to the arrow button for moving |
1062 | // tags from the list of official tags to the list of unofficial tags. |
1063 | - Y.get('#remove-official-tags').on('click', function(e) { |
1064 | + Y.one('#remove-official-tags').on('click', function(e) { |
1065 | var updated_tags = get_updated_tags( |
1066 | official_tags_ul, official_tags, other_tags); |
1067 | official_tags = updated_tags.from_tags; |
1068 | other_tags = updated_tags.to_tags; |
1069 | render_tag_lists(); |
1070 | enable_arrows(); |
1071 | - Y.get('#save-button').set('disabled', false); |
1072 | + Y.one('#save-button').set('disabled', false); |
1073 | }); |
1074 | |
1075 | - Y.get('#new-tag-add').on('click', function(e) { |
1076 | + Y.one('#new-tag-add').on('click', function(e) { |
1077 | on_new_tag_add(); |
1078 | }); |
1079 | |
1080 | // Hook a keypress event handler to the new tag text box. If enter is |
1081 | // pressed, try adding a new tag. |
1082 | - Y.get('#new-tag-text').on('keypress', function(e) { |
1083 | - var new_value = Y.Lang.trim(Y.get('#new-tag-text').get('value')); |
1084 | - Y.get('#new-tag-add').set('disabled', new_value == ''); |
1085 | + Y.one('#new-tag-text').on('keypress', function(e) { |
1086 | + var new_value = Y.Lang.trim(Y.one('#new-tag-text').get('value')); |
1087 | + Y.one('#new-tag-add').set('disabled', new_value == ''); |
1088 | if (e.keyCode == 13) { // Enter == 13 |
1089 | on_new_tag_add(); |
1090 | } |
1091 | }); |
1092 | |
1093 | - Y.get('#save-button').on('click', function(e) { |
1094 | + Y.one('#save-button').on('click', function(e) { |
1095 | e.halt(); |
1096 | save_tags(); |
1097 | }); |
1098 | |
1099 | === modified file 'lib/canonical/launchpad/javascript/bugs/subscriber.js' |
1100 | --- lib/canonical/launchpad/javascript/bugs/subscriber.js 2009-08-03 12:51:30 +0000 |
1101 | +++ lib/canonical/launchpad/javascript/bugs/subscriber.js 2009-11-18 13:45:26 +0000 |
1102 | @@ -75,17 +75,15 @@ |
1103 | */ |
1104 | 'is_already_subscribed': function() { |
1105 | var display_name = this.get('person').get('full_display_name'); |
1106 | - var subscribers = Y.get('#subscribers-links'); |
1107 | - var all_subscribers = subscribers.queryAll('div'); |
1108 | var already_subscribed = false; |
1109 | - if (Y.Lang.isValue(all_subscribers)) { |
1110 | - all_subscribers.each(function(link) { |
1111 | - var name = link.query('a').getAttribute('name'); |
1112 | - if (name == display_name) { |
1113 | - already_subscribed = true; |
1114 | - } |
1115 | - }); |
1116 | - } |
1117 | + |
1118 | + Y.all('#subscribers-links div').each(function(link) { |
1119 | + var name = link.one('a').getAttribute('name'); |
1120 | + if (name == display_name) { |
1121 | + already_subscribed = true; |
1122 | + } |
1123 | + }); |
1124 | + |
1125 | return already_subscribed; |
1126 | }, |
1127 | |
1128 | @@ -310,12 +308,12 @@ |
1129 | if (Y.Lang.isValue(this.get('user_node'))) { |
1130 | user_node = this.get('user_node'); |
1131 | } else { |
1132 | - user_node = Y.get('.subscriber-' + this.get('name')); |
1133 | + user_node = Y.one('.subscriber-' + this.get('name')); |
1134 | } |
1135 | |
1136 | if (Y.Lang.isValue(user_node)) { |
1137 | this.set('user_node', user_node); |
1138 | - var anchor = this.get('user_node').query('a'); |
1139 | + var anchor = this.get('user_node').one('a'); |
1140 | var display_name = anchor.get('name'); |
1141 | return display_name; |
1142 | } else { |
1143 | |
1144 | === modified file 'lib/canonical/launchpad/javascript/bugs/tests/test_me_too.js' |
1145 | --- lib/canonical/launchpad/javascript/bugs/tests/test_me_too.js 2009-08-04 16:19:27 +0000 |
1146 | +++ lib/canonical/launchpad/javascript/bugs/tests/test_me_too.js 2009-11-18 13:45:26 +0000 |
1147 | @@ -16,7 +16,7 @@ |
1148 | * CSS selectors and Node instances instead of raw nodes. |
1149 | */ |
1150 | function simulate(widget, selector, evtype, options) { |
1151 | - var rawnode = Y.Node.getDOMNode(widget.query(selector)); |
1152 | + var rawnode = Y.Node.getDOMNode(widget.one(selector)); |
1153 | Y.Event.simulate(rawnode, evtype, options); |
1154 | } |
1155 | |
1156 | @@ -68,8 +68,8 @@ |
1157 | ' <img src="https://bugs.edge.launchpad.net/@@/flame-icon" alt=""/>', |
1158 | ' </span>', |
1159 | '</span>'].join('')); |
1160 | - Y.get("body").appendChild(inpage); |
1161 | - var me_too_content = Y.get('#affectsmetoo'); |
1162 | + Y.one("body").appendChild(inpage); |
1163 | + var me_too_content = Y.one('#affectsmetoo'); |
1164 | this.config = { |
1165 | contentBox: me_too_content, value: null, |
1166 | elementToFlash: me_too_content |
1167 | @@ -82,7 +82,7 @@ |
1168 | if (this.choice_edit._choice_list) { |
1169 | cleanup_widget(this.choice_edit._choice_list); |
1170 | } |
1171 | - var status = Y.get("document").query("#affectsmetoo"); |
1172 | + var status = Y.one("document").one("#affectsmetoo"); |
1173 | if (status) { |
1174 | status.get("parentNode").removeChild(status); |
1175 | } |
1176 | @@ -101,7 +101,7 @@ |
1177 | * The .static area should be hidden by adding the "unseen" class. |
1178 | */ |
1179 | test_hide_static: function() { |
1180 | - var static_area = this.choice_edit.get('contentBox').query('.static'); |
1181 | + var static_area = this.choice_edit.get('contentBox').one('.static'); |
1182 | Assert.isTrue( |
1183 | static_area.hasClass('unseen'), "Static area is not hidden."); |
1184 | }, |
1185 | @@ -110,7 +110,7 @@ |
1186 | * The .dynamic area should be shown by removing the "unseen" class. |
1187 | */ |
1188 | test_hide_dynamic: function() { |
1189 | - var dynamic_area = this.choice_edit.get('contentBox').query('.dynamic'); |
1190 | + var dynamic_area = this.choice_edit.get('contentBox').one('.dynamic'); |
1191 | Assert.isFalse( |
1192 | dynamic_area.hasClass('unseen'), "Dynamic area is hidden."); |
1193 | }, |
1194 | |
1195 | === modified file 'lib/canonical/launchpad/javascript/bugs/tests/test_subscriber.js' |
1196 | --- lib/canonical/launchpad/javascript/bugs/tests/test_subscriber.js 2009-07-24 15:26:14 +0000 |
1197 | +++ lib/canonical/launchpad/javascript/bugs/tests/test_subscriber.js 2009-11-18 13:45:26 +0000 |
1198 | @@ -99,7 +99,7 @@ |
1199 | name: 'Subscriber Name When Passed Node', |
1200 | |
1201 | setUp: function() { |
1202 | - var node = Y.get('.subscriber-tester'); |
1203 | + var node = Y.one('.subscriber-tester'); |
1204 | this.config = { |
1205 | uri: '/~tester', |
1206 | user_node: node |
1207 | @@ -212,7 +212,7 @@ |
1208 | Y.Assert.isFalse( |
1209 | this.subscription.is_node(), |
1210 | 'Initially, no node should be supplied to the config.'); |
1211 | - var link = Y.get('.menu-link-subscription'); |
1212 | + var link = Y.one('.menu-link-subscription'); |
1213 | this.subscription.set('link', link); |
1214 | Y.Assert.isTrue( |
1215 | this.subscription.is_node(), |
1216 | |
1217 | === modified file 'lib/canonical/launchpad/javascript/client/client.js' |
1218 | --- lib/canonical/launchpad/javascript/client/client.js 2009-10-26 14:57:22 +0000 |
1219 | +++ lib/canonical/launchpad/javascript/client/client.js 2009-11-18 13:45:26 +0000 |
1220 | @@ -69,8 +69,8 @@ |
1221 | result = format(o); |
1222 | } else { |
1223 | result = '(direct-attributes)\n ' + introspect(o); |
1224 | - if (o.getAtts !== undefined) { |
1225 | - result += '\n(get()-attributes)\n ' + introspect(o.getAtts()); |
1226 | + if (o.getAttrs !== undefined) { |
1227 | + result += '\n(get()-attributes)\n ' + introspect(o.getAttrs()); |
1228 | } |
1229 | } |
1230 | if (name !== undefined) { |
1231 | @@ -331,15 +331,19 @@ |
1232 | this.dirty_attributes = []; |
1233 | var entry = this; |
1234 | |
1235 | + // Copy the representation keys into our own set of attributes, and add |
1236 | + // an attribute-change event listener for caching purposes. |
1237 | for (key in representation) { |
1238 | if (representation.hasOwnProperty(key)) { |
1239 | - this.addAtt(key, {value: representation[key]}); |
1240 | + this.addAttr(key, {value: representation[key]}); |
1241 | this.on(key + "Change", this.mark_as_dirty); |
1242 | } |
1243 | } |
1244 | }; |
1245 | |
1246 | LP.client.Entry.prototype = new LP.client.Resource(); |
1247 | + |
1248 | +// Augment with Attribute so that we can listen for attribute change events. |
1249 | Y.augment(LP.client.Entry, Y.Attribute); |
1250 | |
1251 | LP.client.Entry.prototype.mark_as_dirty = function(event) { |
1252 | @@ -669,7 +673,8 @@ |
1253 | } |
1254 | }; |
1255 | |
1256 | -Y.extend(PATCHPlugin, Y.Plugin, { |
1257 | + |
1258 | +Y.extend(PATCHPlugin, Y.Plugin.Base, { |
1259 | |
1260 | /** |
1261 | * Configuration parameters that will be passed through to the LP.client |
1262 | @@ -702,7 +707,7 @@ |
1263 | |
1264 | // Save a reference to the original _saveData() |
1265 | //method before wrapping it. |
1266 | - this.original_save = config.owner._saveData; |
1267 | + this.original_save = config.host._saveData; |
1268 | |
1269 | // We want to run our PATCH code instead of the original |
1270 | // 'save' method. Using doBefore() means that |
1271 | @@ -713,10 +718,10 @@ |
1272 | var self = this; |
1273 | this.error_handler = new LP.client.ErrorHandler(); |
1274 | this.error_handler.clearProgressUI = function () { |
1275 | - self._owner._uiClearWaiting(); |
1276 | + config.host._uiClearWaiting(); |
1277 | }; |
1278 | this.error_handler.showError = function (error_msg) { |
1279 | - self._owner.showError(error_msg); |
1280 | + config.host.showError(error_msg); |
1281 | }; |
1282 | }, |
1283 | |
1284 | @@ -732,7 +737,7 @@ |
1285 | * @method doPATCH |
1286 | */ |
1287 | doPATCH: function() { |
1288 | - var owner = this._owner, |
1289 | + var owner = this.get("host"), |
1290 | original_save = this.original_save; |
1291 | |
1292 | // Set the widget in 'waiting' state. |
1293 | |
1294 | === modified file 'lib/canonical/launchpad/javascript/code/branchlinks.js' |
1295 | --- lib/canonical/launchpad/javascript/code/branchlinks.js 2009-08-13 13:16:04 +0000 |
1296 | +++ lib/canonical/launchpad/javascript/code/branchlinks.js 2009-11-18 13:45:26 +0000 |
1297 | @@ -44,7 +44,7 @@ |
1298 | }); |
1299 | link_bug_overlay.render(); |
1300 | link_bug_overlay.loadFormContentAndRender('+linkbug/++form++'); |
1301 | - var linkbug_handle = Y.get('#linkbug'); |
1302 | + var linkbug_handle = Y.one('#linkbug'); |
1303 | linkbug_handle.addClass('js-action'); |
1304 | linkbug_handle.on('click', function(e) { |
1305 | e.preventDefault(); |
1306 | @@ -59,14 +59,11 @@ |
1307 | * remove the links. |
1308 | */ |
1309 | function connect_remove_links() { |
1310 | - var linked_bugs = Y.all('.delete-buglink'); |
1311 | - if (Y.Lang.isValue(linked_bugs)) { |
1312 | - linked_bugs.on('click', function(e) { |
1313 | - e.preventDefault(); |
1314 | - var bugnumber = get_bugnumber_from_id(e.currentTarget.get('id')); |
1315 | - unlink_bug_from_branch(bugnumber); |
1316 | - }); |
1317 | - } |
1318 | + Y.on('click', function(e) { |
1319 | + e.preventDefault(); |
1320 | + var bugnumber = get_bugnumber_from_id(e.currentTarget.get('id')); |
1321 | + unlink_bug_from_branch(bugnumber); |
1322 | + }, '.delete-buglink'); |
1323 | } |
1324 | |
1325 | /* |
1326 | @@ -78,7 +75,7 @@ |
1327 | create_temporary_spinner(); |
1328 | |
1329 | var bugnumber = data['field.bug']; |
1330 | - var existing = Y.get('#buglink-' + bugnumber); |
1331 | + var existing = Y.one('#buglink-' + bugnumber); |
1332 | if (Y.Lang.isValue(existing)) { |
1333 | // Bug is already linked, don't do unneccessary requests. |
1334 | Y.lazr.anim.green_flash({node: existing}).run(); |
1335 | @@ -124,10 +121,10 @@ |
1336 | on: { |
1337 | success: function(id, response) { |
1338 | destroy_temporary_spinner(); |
1339 | - Y.get('#linkbug').set( |
1340 | + Y.one('#linkbug').set( |
1341 | 'innerHTML', 'Link to another bug report'); |
1342 | - Y.get('#buglink-list').set('innerHTML', response.responseText); |
1343 | - var new_buglink = Y.get('#buglink-' + bug.get('id')); |
1344 | + Y.one('#buglink-list').set('innerHTML', response.responseText); |
1345 | + var new_buglink = Y.one('#buglink-' + bug.get('id')); |
1346 | var anim = Y.lazr.anim.green_flash({node: new_buglink}); |
1347 | anim.on('end', connect_remove_links); |
1348 | anim.run(); |
1349 | @@ -150,14 +147,14 @@ |
1350 | function unlink_bug_from_branch(bugnumber) { |
1351 | link_bug_overlay.hide(); |
1352 | |
1353 | - Y.get('#delete-buglink-' + bugnumber).get('children').set( |
1354 | + Y.one('#delete-buglink-' + bugnumber).get('children').set( |
1355 | 'src', '/@@/spinner'); |
1356 | get_bug_from_bugnumber(bugnumber, function(bug) { |
1357 | |
1358 | config = { |
1359 | on: { |
1360 | success: function(updated_entry) { |
1361 | - var element = Y.get('#buglink-' + bugnumber); |
1362 | + var element = Y.one('#buglink-' + bugnumber); |
1363 | var parent_element = element.get('parentNode'); |
1364 | anim = Y.lazr.anim.red_flash({node: element}); |
1365 | anim.on('end', function() { |
1366 | @@ -165,8 +162,8 @@ |
1367 | |
1368 | // Check to see if that was the only bug linked. |
1369 | var buglinks = Y.all(".bug-branch-summary"); |
1370 | - if (!buglinks) { |
1371 | - Y.get('#linkbug').set('innerHTML', |
1372 | + if (buglinks.size() == 0) { |
1373 | + Y.one('#linkbug').set('innerHTML', |
1374 | 'Link to a bug report'); |
1375 | } |
1376 | }); |
1377 | @@ -174,7 +171,7 @@ |
1378 | }, |
1379 | failure: function(id, response) { |
1380 | alert('An unexpected error has occurred.'); |
1381 | - Y.get('#delete-buglink-' + bugnumber).get('children').set( |
1382 | + Y.one('#delete-buglink-' + bugnumber).get('children').set( |
1383 | 'src', '/@@/remove'); |
1384 | Y.log(response.responseText); |
1385 | } |
1386 | @@ -237,8 +234,8 @@ |
1387 | '<div id="temp-spinner">', |
1388 | '<img src="/@@/spinner"/>Linking...', |
1389 | '</div>'].join('')); |
1390 | - var buglinks = Y.get('#buglinks'); |
1391 | - var last = Y.get('#linkbug').get('parentNode'); |
1392 | + var buglinks = Y.one('#buglinks'); |
1393 | + var last = Y.one('#linkbug').get('parentNode'); |
1394 | if (last) { |
1395 | buglinks.insertBefore(temp_spinner, last); |
1396 | } |
1397 | @@ -249,7 +246,7 @@ |
1398 | */ |
1399 | function destroy_temporary_spinner() { |
1400 | |
1401 | - var temp_spinner = Y.get('#temp-spinner'); |
1402 | + var temp_spinner = Y.one('#temp-spinner'); |
1403 | var spinner_parent = temp_spinner.get('parentNode'); |
1404 | spinner_parent.removeChild(temp_spinner); |
1405 | |
1406 | |
1407 | === modified file 'lib/canonical/launchpad/javascript/code/branchstatus.js' |
1408 | --- lib/canonical/launchpad/javascript/code/branchstatus.js 2009-11-10 05:12:59 +0000 |
1409 | +++ lib/canonical/launchpad/javascript/code/branchstatus.js 2009-11-18 13:45:26 +0000 |
1410 | @@ -15,7 +15,7 @@ |
1411 | */ |
1412 | Y.branchstatus.connect_status = function(conf) { |
1413 | |
1414 | - var status_content = Y.get('#branch-details-status-value'); |
1415 | + var status_content = Y.one('#branch-details-status-value'); |
1416 | |
1417 | if |
1418 | (conf.user_can_edit_status) { |
1419 | @@ -31,9 +31,9 @@ |
1420 | var cb = status_choice_edit.get('contentBox'); |
1421 | Y.Array.each(conf.status_widget_items, function(item) { |
1422 | if (item.value == status_choice_edit.get('value')) { |
1423 | - cb.query('span').addClass(item.css_class); |
1424 | + cb.one('span').addClass(item.css_class); |
1425 | } else { |
1426 | - cb.query('span').removeClass(item.css_class); |
1427 | + cb.one('span').removeClass(item.css_class); |
1428 | } |
1429 | }); |
1430 | }); |
1431 | |
1432 | === modified file 'lib/canonical/launchpad/javascript/code/branchsubscription.js' |
1433 | --- lib/canonical/launchpad/javascript/code/branchsubscription.js 2009-08-13 13:47:24 +0000 |
1434 | +++ lib/canonical/launchpad/javascript/code/branchsubscription.js 2009-11-18 13:45:26 +0000 |
1435 | @@ -38,15 +38,15 @@ |
1436 | Y.io('+branch-portlet-subscriber-content', { |
1437 | on: { |
1438 | success: function(id, response) { |
1439 | - Y.get('#subscriber-list').set( |
1440 | + Y.one('#subscriber-list').set( |
1441 | 'innerHTML', response.responseText); |
1442 | - Y.get('#subscriber-list').setStyle('display', 'block'); |
1443 | + Y.one('#subscriber-list').setStyle('display', 'block'); |
1444 | if (highlight) { |
1445 | animate_subscription_update(); |
1446 | } |
1447 | }, |
1448 | failure: function(id, response) { |
1449 | - Y.get('#subscriber-list').set( |
1450 | + Y.one('#subscriber-list').set( |
1451 | 'innerHTML', 'A problem has occurred.'); |
1452 | Y.log(reponse.responseText); |
1453 | }, |
1454 | @@ -77,7 +77,7 @@ |
1455 | subscription_form_overlay.hide(); |
1456 | |
1457 | me = LP.client.links.me; |
1458 | - var selfsubscriptioncontainer = Y.get('#selfsubscriptioncontainer'); |
1459 | + var selfsubscriptioncontainer = Y.one('#selfsubscriptioncontainer'); |
1460 | selfsubscriptioncontainer.set('innerHTML', |
1461 | '<img src="/@@/spinner">Subscribing...'); |
1462 | |
1463 | @@ -104,7 +104,7 @@ |
1464 | |
1465 | // XXX: rockstar: bug=336866 The etag returned by lp_save() is |
1466 | // totally wrong. |
1467 | - lp_subscription_entry.removeAtt('http_etag'); |
1468 | + lp_subscription_entry.removeAttr('http_etag'); |
1469 | |
1470 | selfsubscriptioncontainer.setStyle('display', 'none'); |
1471 | Y.code.branchsubscription.update_subscriber_list(true); |
1472 | @@ -133,7 +133,7 @@ |
1473 | */ |
1474 | function set_up_self_subscription_formoverlay(element_id) { |
1475 | |
1476 | - var subscribe_yourself = Y.get('#selfsubscription'); |
1477 | + var subscribe_yourself = Y.one('#selfsubscription'); |
1478 | |
1479 | if (subscribe_yourself !== null) { |
1480 | |
1481 | @@ -158,8 +158,8 @@ |
1482 | /* XXX: rockstar - bug=389185 - The form is a bit wide for the current |
1483 | * form overlay, and there isn't an easy way to resize it, thus this hack. |
1484 | */ |
1485 | - Y.get('#shadow').setStyle('width', '562px'); |
1486 | - Y.get('div#yui-pretty-overlay-modal.content_box_container').setStyle( |
1487 | + Y.one('#shadow').setStyle('width', '562px'); |
1488 | + Y.one('div#yui-pretty-overlay-modal.content_box_container').setStyle( |
1489 | 'width', '500px'); |
1490 | subscribe_yourself.addClass('js-action'); |
1491 | subscribe_yourself.on('click', function(e) { |
1492 | @@ -176,7 +176,7 @@ |
1493 | * Hides the "Edit your subscription" link. |
1494 | */ |
1495 | function hide_edit_your_subscription() { |
1496 | - var element = Y.get('#selfsubscription'); |
1497 | + var element = Y.one('#selfsubscription'); |
1498 | if (element !== null) { |
1499 | if (element.get('innerHTML') == 'Edit your subscription') { |
1500 | element.setStyle('display', 'none'); |
1501 | @@ -203,13 +203,13 @@ |
1502 | ' style="position:absolute;right:8px" /></div>'].join(''); |
1503 | var link_node = Y.Node.create(html); |
1504 | |
1505 | - var subscribers = Y.get('#subscriber-list'); |
1506 | - var next = subscribers.query('div')[0]; |
1507 | + var subscribers = Y.one('#subscriber-list'); |
1508 | + var next = subscribers.one('div')[0]; |
1509 | if (next) { |
1510 | subscribers.insertBefore(link_node, next); |
1511 | } else { |
1512 | // Handle the case of the displayed "None". |
1513 | - var none_subscribers = Y.get('#none-subscribers'); |
1514 | + var none_subscribers = Y.one('#none-subscribers'); |
1515 | if (none_subscribers) { |
1516 | var none_parent = none_subscribers.get('parentNode'); |
1517 | none_parent.removeChild(none_subscribers); |
1518 | @@ -261,7 +261,7 @@ |
1519 | |
1520 | |
1521 | function animate_subscription_update() { |
1522 | - var element = Y.get('#subscriber-' + user_name); |
1523 | + var element = Y.one('#subscriber-' + user_name); |
1524 | var anim = Y.lazr.anim.green_flash({node: element}); |
1525 | anim.run(); |
1526 | } |
1527 | |
1528 | === modified file 'lib/canonical/launchpad/javascript/code/codereview.js' |
1529 | --- lib/canonical/launchpad/javascript/code/codereview.js 2009-10-28 16:49:59 +0000 |
1530 | +++ lib/canonical/launchpad/javascript/code/codereview.js 2009-11-18 13:45:26 +0000 |
1531 | @@ -18,7 +18,7 @@ |
1532 | */ |
1533 | Y.codereview.connect_links = function() { |
1534 | |
1535 | - var link = Y.get('#request-review'); |
1536 | + var link = Y.one('#request-review'); |
1537 | if (link !== null) { |
1538 | link.addClass('js-action'); |
1539 | link.on('click', show_request_review_form); |
1540 | @@ -39,7 +39,7 @@ |
1541 | reviewer_picker = Y.lp.picker.create( |
1542 | 'ValidPersonOrTeam', |
1543 | function(result) { |
1544 | - var review_type = Y.get("[id=field.review_type]").get('value'); |
1545 | + var review_type = Y.one("[id=field.review_type]").get('value'); |
1546 | request_reviewer(result, review_type); |
1547 | }, |
1548 | config); |
1549 | @@ -67,7 +67,7 @@ |
1550 | '<img src="/@@/spinner" />', |
1551 | 'Requesting review...', |
1552 | '</td></tr>'].join("")); |
1553 | - var last_element = Y.get('#email-review'); |
1554 | + var last_element = Y.one('#email-review'); |
1555 | var reviewer_table = last_element.get('parentNode'); |
1556 | reviewer_table.insertBefore(table_row, last_element); |
1557 | |
1558 | @@ -110,11 +110,11 @@ |
1559 | Y.io(VOTES_TABLE_PATH, { |
1560 | on: { |
1561 | success: function(id, response) { |
1562 | - var target = Y.get('#votes-target'); |
1563 | + var target = Y.one('#votes-target'); |
1564 | target.set('innerHTML', response.responseText); |
1565 | |
1566 | Y.codereview.connect_links(); |
1567 | - var new_reviewer = Y.get('#review-' + username); |
1568 | + var new_reviewer = Y.one('#review-' + username); |
1569 | var anim = Y.lazr.anim.green_flash({node: new_reviewer}); |
1570 | anim.run(); |
1571 | }, |
1572 | @@ -147,11 +147,11 @@ |
1573 | var ui = Y.Node.create('<li><label>' + |
1574 | '<input type="checkbox" checked="checked" id="show-no"/>' + |
1575 | ' Show line numbers</label></li>'); |
1576 | - var ul = Y.get('#review-diff div div ul.horizontal'); |
1577 | + var ul = Y.one('#review-diff div div ul.horizontal'); |
1578 | ul.appendChild(ui); |
1579 | }, |
1580 | bindUI: function(){ |
1581 | - Y.get('#show-no').on('click', update_nos); |
1582 | + Y.one('#show-no').on('click', update_nos); |
1583 | } |
1584 | }); |
1585 | |
1586 | |
1587 | === modified file 'lib/canonical/launchpad/javascript/lp/calendar.js' |
1588 | --- lib/canonical/launchpad/javascript/lp/calendar.js 2009-07-17 00:26:05 +0000 |
1589 | +++ lib/canonical/launchpad/javascript/lp/calendar.js 2009-11-18 13:45:26 +0000 |
1590 | @@ -125,7 +125,7 @@ |
1591 | |
1592 | // Ensure that when the ok button is click, the calendar's |
1593 | // selectEvent is fired and the calendar closed. |
1594 | - var ok_button = time_selector_node.query('.lazr-btn'); |
1595 | + var ok_button = time_selector_node.one('.lazr-btn'); |
1596 | Y.on("click", function(e) { |
1597 | calendar_widget.selectEvent.fire(); |
1598 | calendar_widget.hide(); |
1599 | @@ -153,9 +153,9 @@ |
1600 | |
1601 | if (is_datetime_widget) { |
1602 | hours = pad_with_zero( |
1603 | - time_selector_node.query('.hours').get('value')); |
1604 | + time_selector_node.one('.hours').get('value')); |
1605 | minutes = pad_with_zero( |
1606 | - time_selector_node.query('.minutes').get('value')); |
1607 | + time_selector_node.one('.minutes').get('value')); |
1608 | value_string += " " + hours + ":" + minutes; |
1609 | } |
1610 | |
1611 | |
1612 | === modified file 'lib/canonical/launchpad/javascript/lp/comment.js' |
1613 | --- lib/canonical/launchpad/javascript/lp/comment.js 2009-10-28 14:56:45 +0000 |
1614 | +++ lib/canonical/launchpad/javascript/lp/comment.js 2009-11-18 13:45:26 +0000 |
1615 | @@ -20,7 +20,7 @@ |
1616 | */ |
1617 | initializer: function() { |
1618 | this.submit_button = this.get_submit(); |
1619 | - this.comment_input = Y.get('[id="field.comment"]'); |
1620 | + this.comment_input = Y.one('[id="field.comment"]'); |
1621 | this.lp_client = new LP.client.Launchpad(); |
1622 | this.error_handler = new LP.client.ErrorHandler(); |
1623 | this.error_handler.clearProgressUI = bind(this.clearProgressUI, this); |
1624 | @@ -39,7 +39,7 @@ |
1625 | * @method get_submit |
1626 | */ |
1627 | get_submit: function(){ |
1628 | - return Y.get('[id="field.actions.save"]'); |
1629 | + return Y.one('[id="field.actions.save"]'); |
1630 | }, |
1631 | /** |
1632 | * Implementation of Widget.renderUI. |
1633 | @@ -131,7 +131,7 @@ |
1634 | * @param message_html The HTML of the comment to insert. |
1635 | */ |
1636 | insert_comment_HTML: function(message_html) { |
1637 | - var fieldset = Y.get('#add-comment-form'); |
1638 | + var fieldset = Y.one('#add-comment-form'); |
1639 | var comment = Y.Node.create(message_html); |
1640 | fieldset.get('parentNode').insertBefore(comment, fieldset); |
1641 | this.reset_contents(); |
1642 | @@ -209,8 +209,8 @@ |
1643 | * @method initializer |
1644 | */ |
1645 | initializer: function() { |
1646 | - this.vote_input = Y.get('[id="field.vote"]'); |
1647 | - this.review_type = Y.get('[id="field.review_type"]'); |
1648 | + this.vote_input = Y.one('[id="field.vote"]'); |
1649 | + this.review_type = Y.one('[id="field.review_type"]'); |
1650 | this.in_reply_to = null; |
1651 | }, |
1652 | /** |
1653 | @@ -219,7 +219,7 @@ |
1654 | * @method get_submit |
1655 | */ |
1656 | get_submit: function(){ |
1657 | - return Y.get('[id="field.actions.add"]'); |
1658 | + return Y.one('[id="field.actions.add"]'); |
1659 | }, |
1660 | /** |
1661 | * Return the vote value selected, or null if none is selected. |
1662 | @@ -313,7 +313,7 @@ |
1663 | reply_link.length - '+reply'.length); |
1664 | var object_url = '/api/beta' + root_url; |
1665 | this.activateProgressUI('Loading...'); |
1666 | - window.scrollTo(0, Y.get('label [for=field.vote]').getY()); |
1667 | + window.scrollTo(0, Y.one('label [for=field.vote]').getY()); |
1668 | this.lp_client.get(object_url, { |
1669 | on: { |
1670 | success: bind(function(comment){ |
1671 | @@ -352,7 +352,7 @@ |
1672 | * @param message_html The HTML of the comment to insert. |
1673 | */ |
1674 | insert_comment_HTML: function(message_html){ |
1675 | - var conversation = Y.get('[id=conversation]'); |
1676 | + var conversation = Y.one('[id=conversation]'); |
1677 | var comment = Y.Node.create(message_html); |
1678 | conversation.appendChild(comment); |
1679 | this.reset_contents(); |
1680 | @@ -360,7 +360,7 @@ |
1681 | }, |
1682 | renderUI: function() { |
1683 | CodeReviewComment.superclass.renderUI.apply(this); |
1684 | - Y.get('#inline-add-comment').setStyle('display', 'block'); |
1685 | + Y.one('#inline-add-comment').setStyle('display', 'block'); |
1686 | }, |
1687 | /** |
1688 | * Implementation of Widget.bindUI: Bind events to methods. |
1689 | |
1690 | === modified file 'lib/canonical/launchpad/javascript/lp/lp.js' |
1691 | --- lib/canonical/launchpad/javascript/lp/lp.js 2009-07-24 12:32:28 +0000 |
1692 | +++ lib/canonical/launchpad/javascript/lp/lp.js 2009-11-18 13:45:26 +0000 |
1693 | @@ -61,8 +61,8 @@ |
1694 | */ |
1695 | Y.lp.toggle_collapsible = function(collapsible) { |
1696 | // Find the collapse icon and wrapper div for this collapsible. |
1697 | - var icon = collapsible.query('.collapseIcon'); |
1698 | - var wrapper_div = collapsible.query('.collapseWrapper'); |
1699 | + var icon = collapsible.one('.collapseIcon'); |
1700 | + var wrapper_div = collapsible.one('.collapseWrapper'); |
1701 | |
1702 | // If either the wrapper or the icon is null, raise an error. |
1703 | if (wrapper_div === null) { |
1704 | @@ -102,131 +102,129 @@ |
1705 | */ |
1706 | Y.lp.activate_collapsibles = function() { |
1707 | // Grab the collapsibles. |
1708 | - var collapsibles = Y.all('.collapsible'); |
1709 | - if (collapsibles !== null) { |
1710 | - Y.each(collapsibles, function(collapsible) { |
1711 | - var legend = collapsible.query('legend'); |
1712 | - if (legend === null || |
1713 | - legend.query('.collapseIcon') !== null) { |
1714 | - // If there's no legend there's not much we can do, |
1715 | - // so just exit this iteration. If there's a |
1716 | - // collapseIcon in there we consider the collapsible |
1717 | - // to already have been set up and therefore ignore |
1718 | - // it this time around. |
1719 | - return; |
1720 | - } |
1721 | - |
1722 | - var icon = Y.Node.create( |
1723 | - '<img src="/@@/treeExpanded" class="collapseIcon" />'); |
1724 | - |
1725 | - // We use javascript:void(0) here (though it will cause |
1726 | - // lint to complain) because it prevents clicking on the |
1727 | - // anchor from altering the page URL, which can subtly |
1728 | - // break things. |
1729 | - var anchor = Y.Node.create( |
1730 | - '<a href="javascript:void(0);"></a>'); |
1731 | - anchor.appendChild(icon); |
1732 | - |
1733 | - // Move the contents of the legend into the span. We use |
1734 | - // the verbose version of <span /> to avoid silly |
1735 | - // breakages in Firefox. |
1736 | - var span = Y.Node.create('<span></span>'); |
1737 | - var legend_children = legend.get('children'); |
1738 | - var len; |
1739 | - |
1740 | - if (Y.Lang.isValue(legend_children)) { |
1741 | - // XXX 2009-07-06 gmb Account for oddness from |
1742 | - // Node.get('children'); (see YUI ticket 2528028 for |
1743 | - // details). |
1744 | - len = legend_children.size ? |
1745 | - legend_children.size() : legend_children.length; |
1746 | - } else { |
1747 | - len = 0; |
1748 | - } |
1749 | - |
1750 | - if (len > 0) { |
1751 | - // If the legend has child elements, move them |
1752 | - // across one by one. |
1753 | - Y.each(legend_children, function(child_node) { |
1754 | - if (child_node.get('tagName') == 'A') { |
1755 | - // If this child is an anchor, add only its |
1756 | - // contents to the span. |
1757 | - new_node = Y.Node.create( |
1758 | - child_node.get('innerHTML')); |
1759 | - span.appendChild(new_node); |
1760 | - legend.removeChild(child_node); |
1761 | - } else { |
1762 | - // Otherwise, add the node to the span as it |
1763 | - // is. |
1764 | - span.appendChild(child_node); |
1765 | - } |
1766 | - }); |
1767 | - } else { |
1768 | - // Otherwise just move the innerHTML across as a |
1769 | - // block. Once the span is appended to the anchor, |
1770 | - // this will essentially turn the contents of the |
1771 | - // legend into a link. |
1772 | - span.set('innerHTML', legend.get('innerHTML')); |
1773 | - legend.set('innerHTML', ''); |
1774 | - } |
1775 | - |
1776 | - // Replace the contents of the legend with the anchor. |
1777 | - anchor.appendChild(span); |
1778 | - legend.appendChild(anchor); |
1779 | - |
1780 | - // Put a wrapper around the fieldset contents for ease |
1781 | - // of hiding. |
1782 | - var wrapper_div = Y.Node.create( |
1783 | - '<div class="collapseWrapper" />'); |
1784 | - |
1785 | - // Loop over the children of the collapsible and move them |
1786 | - // into the wrapper div. We remove the legend from the |
1787 | - // collapsible at this point to make sure it gets left |
1788 | - // outside the wrapper div; we'll add it again later. |
1789 | - collapsible.removeChild(legend); |
1790 | - |
1791 | - // "Why do this as a while?" I hear you cry. Well, it's |
1792 | - // because using Y.each() leads to interesting results |
1793 | - // in FF3.5, Opera and Chrome, since by doing |
1794 | - // appendChild() with each child node (and thus removing |
1795 | - // them from the collapsible) means you're altering the |
1796 | - // collection as you're looping over it, which is a Bad |
1797 | - // Thing. This isn't as pretty but it actually works. |
1798 | - var first_child = collapsible.query(':first-child'); |
1799 | - while (Y.Lang.isValue(first_child)) { |
1800 | - wrapper_div.appendChild(first_child); |
1801 | - first_child = collapsible.query(':first-child'); |
1802 | - } |
1803 | - |
1804 | - // Put the legend and the new wrapper div into the |
1805 | - // collapsible in the right order. |
1806 | - collapsible.appendChild(legend); |
1807 | - collapsible.appendChild(wrapper_div); |
1808 | - |
1809 | - // If the collapsible is to be collapsed on pageload, do |
1810 | - // so. |
1811 | - if (collapsible.hasClass('collapsed')) { |
1812 | - // Strip out the 'collapsed' class as it's no longer |
1813 | - // needed. |
1814 | - collapsible.removeClass('collapsed'); |
1815 | - |
1816 | - // We use the slide_in effect to hide the |
1817 | - // collapsible because it sets up all the properties |
1818 | - // and classes for the element properly and saves us |
1819 | - // from embarrasment later on. |
1820 | - var slide_in = Y.lazr.effects.slide_in(wrapper_div); |
1821 | - slide_in.run(); |
1822 | - |
1823 | - icon.set('src', '/@@/treeCollapsed'); |
1824 | - } |
1825 | - |
1826 | - // Finally, add toggle_collapsible() as an onclick |
1827 | - // handler to the anchor. |
1828 | - anchor.on('click', function(e) { |
1829 | - Y.lp.toggle_collapsible(collapsible); |
1830 | + Y.all('.collapsible').each(function(collapsible) { |
1831 | + |
1832 | + var legend = collapsible.one('legend'); |
1833 | + if (legend === null || |
1834 | + legend.one('.collapseIcon') !== null) { |
1835 | + // If there's no legend there's not much we can do, |
1836 | + // so just exit this iteration. If there's a |
1837 | + // collapseIcon in there we consider the collapsible |
1838 | + // to already have been set up and therefore ignore |
1839 | + // it this time around. |
1840 | + return; |
1841 | + } |
1842 | + |
1843 | + var icon = Y.Node.create( |
1844 | + '<img src="/@@/treeExpanded" class="collapseIcon" />'); |
1845 | + |
1846 | + // We use javascript:void(0) here (though it will cause |
1847 | + // lint to complain) because it prevents clicking on the |
1848 | + // anchor from altering the page URL, which can subtly |
1849 | + // break things. |
1850 | + var anchor = Y.Node.create( |
1851 | + '<a href="javascript:void(0);"></a>'); |
1852 | + anchor.appendChild(icon); |
1853 | + |
1854 | + // Move the contents of the legend into the span. We use |
1855 | + // the verbose version of <span /> to avoid silly |
1856 | + // breakages in Firefox. |
1857 | + var span = Y.Node.create('<span></span>'); |
1858 | + var legend_children = legend.get('children'); |
1859 | + var len; |
1860 | + |
1861 | + if (Y.Lang.isValue(legend_children)) { |
1862 | + // XXX 2009-07-06 gmb Account for oddness from |
1863 | + // Node.get('children'); (see YUI ticket 2528028 for |
1864 | + // details). |
1865 | + len = legend_children.size ? |
1866 | + legend_children.size() : legend_children.length; |
1867 | + } else { |
1868 | + len = 0; |
1869 | + } |
1870 | + |
1871 | + if (len > 0) { |
1872 | + // If the legend has child elements, move them |
1873 | + // across one by one. |
1874 | + Y.each(legend_children, function(child_node) { |
1875 | + if (child_node.get('tagName') == 'A') { |
1876 | + // If this child is an anchor, add only its |
1877 | + // contents to the span. |
1878 | + new_node = Y.Node.create( |
1879 | + child_node.get('innerHTML')); |
1880 | + span.appendChild(new_node); |
1881 | + legend.removeChild(child_node); |
1882 | + } else { |
1883 | + // Otherwise, add the node to the span as it |
1884 | + // is. |
1885 | + span.appendChild(child_node); |
1886 | + } |
1887 | }); |
1888 | + } else { |
1889 | + // Otherwise just move the innerHTML across as a |
1890 | + // block. Once the span is appended to the anchor, |
1891 | + // this will essentially turn the contents of the |
1892 | + // legend into a link. |
1893 | + span.set('innerHTML', legend.get('innerHTML')); |
1894 | + legend.set('innerHTML', ''); |
1895 | + } |
1896 | + |
1897 | + // Replace the contents of the legend with the anchor. |
1898 | + anchor.appendChild(span); |
1899 | + legend.appendChild(anchor); |
1900 | + |
1901 | + // Put a wrapper around the fieldset contents for ease |
1902 | + // of hiding. |
1903 | + var wrapper_div = Y.Node.create( |
1904 | + '<div class="collapseWrapper" />'); |
1905 | + |
1906 | + // Loop over the children of the collapsible and move them |
1907 | + // into the wrapper div. We remove the legend from the |
1908 | + // collapsible at this point to make sure it gets left |
1909 | + // outside the wrapper div; we'll add it again later. |
1910 | + collapsible.removeChild(legend); |
1911 | + |
1912 | + // "Why do this as a while?" I hear you cry. Well, it's |
1913 | + // because using Y.each() leads to interesting results |
1914 | + // in FF3.5, Opera and Chrome, since by doing |
1915 | + // appendChild() with each child node (and thus removing |
1916 | + // them from the collapsible) means you're altering the |
1917 | + // collection as you're looping over it, which is a Bad |
1918 | + // Thing. This isn't as pretty but it actually works. |
1919 | + var first_child = collapsible.one(':first-child'); |
1920 | + while (Y.Lang.isValue(first_child)) { |
1921 | + wrapper_div.appendChild(first_child); |
1922 | + first_child = collapsible.one(':first-child'); |
1923 | + } |
1924 | + |
1925 | + // Put the legend and the new wrapper div into the |
1926 | + // collapsible in the right order. |
1927 | + collapsible.appendChild(legend); |
1928 | + collapsible.appendChild(wrapper_div); |
1929 | + |
1930 | + // If the collapsible is to be collapsed on pageload, do |
1931 | + // so. |
1932 | + if (collapsible.hasClass('collapsed')) { |
1933 | + // Strip out the 'collapsed' class as it's no longer |
1934 | + // needed. |
1935 | + collapsible.removeClass('collapsed'); |
1936 | + |
1937 | + // We use the slide_in effect to hide the |
1938 | + // collapsible because it sets up all the properties |
1939 | + // and classes for the element properly and saves us |
1940 | + // from embarrasment later on. |
1941 | + var slide_in = Y.lazr.effects.slide_in(wrapper_div); |
1942 | + slide_in.run(); |
1943 | + |
1944 | + icon.set('src', '/@@/treeCollapsed'); |
1945 | + } |
1946 | + |
1947 | + // Finally, add toggle_collapsible() as an onclick |
1948 | + // handler to the anchor. |
1949 | + anchor.on('click', function(e) { |
1950 | + Y.lp.toggle_collapsible(collapsible); |
1951 | }); |
1952 | - } |
1953 | + }); |
1954 | }; |
1955 | |
1956 | }, '0.1', {requires:['cookie', 'lazr.effects']}); |
1957 | |
1958 | === modified file 'lib/canonical/launchpad/javascript/lp/mapping.js' |
1959 | --- lib/canonical/launchpad/javascript/lp/mapping.js 2009-10-16 09:25:45 +0000 |
1960 | +++ lib/canonical/launchpad/javascript/lp/mapping.js 2009-11-18 13:45:26 +0000 |
1961 | @@ -102,16 +102,16 @@ |
1962 | */ |
1963 | mapping.setLocation = function(lat, lng, geoname, |
1964 | tz_name, lat_name, lng_name) { |
1965 | - Y.get(Y.DOM.byId(lat_name)).set('value', lat); |
1966 | - Y.get(Y.DOM.byId(lng_name)).set('value', lng); |
1967 | - var spinner = Y.get('#tz_spinner'); |
1968 | + Y.one(Y.DOM.byId(lat_name)).set('value', lat); |
1969 | + Y.one(Y.DOM.byId(lng_name)).set('value', lng); |
1970 | + var spinner = Y.one('#tz_spinner'); |
1971 | spinner.set('src', '/@@/spinner'); |
1972 | |
1973 | function succeeded() { |
1974 | if (request.readyState == 4) { |
1975 | if (request.responseText) { |
1976 | var tz = request.responseJSON.timezoneId; |
1977 | - Y.get(Y.DOM.byId(tz_name)).set('value', tz); |
1978 | + Y.one(Y.DOM.byId(tz_name)).set('value', tz); |
1979 | spinner.set('src', '/@@/nospin'); |
1980 | } |
1981 | } |
1982 | @@ -164,7 +164,7 @@ |
1983 | var label = Y.Node.create('<label></label>'); |
1984 | label.appendChild(checkbox); |
1985 | label.appendChild(label_text); |
1986 | - var action_div = Y.get(div_id); |
1987 | + var action_div = Y.one(div_id); |
1988 | action_div.appendChild(label); |
1989 | if (!show_small_maps) { |
1990 | mapping.toggleShowSmallMaps(checkbox); |
1991 | |
1992 | === modified file 'lib/canonical/launchpad/javascript/lp/picker.js' |
1993 | --- lib/canonical/launchpad/javascript/lp/picker.js 2009-09-28 11:51:08 +0000 |
1994 | +++ lib/canonical/launchpad/javascript/lp/picker.js 2009-11-18 13:45:26 +0000 |
1995 | @@ -42,7 +42,7 @@ |
1996 | } |
1997 | } |
1998 | |
1999 | - var content_box = Y.get('#' + content_box_id); |
2000 | + var content_box = Y.one('#' + content_box_id); |
2001 | |
2002 | var activator = new Y.lazr.activator.Activator( |
2003 | {contentBox: content_box}); |
2004 | @@ -56,7 +56,7 @@ |
2005 | }; |
2006 | |
2007 | var show_hide_buttons = function () { |
2008 | - var link = content_box.query('.yui-activator-data-box a'); |
2009 | + var link = content_box.one('.yui-activator-data-box a'); |
2010 | if (remove_button) { |
2011 | if (link === null || !show_remove_button) { |
2012 | remove_button.addClass('yui-picker-hidden'); |
2013 | @@ -89,7 +89,7 @@ |
2014 | if (element.tagName == 'DD') { |
2015 | if (current_field == attribute_name) { |
2016 | // The field value is found |
2017 | - node = Y.get(element).query('span'); |
2018 | + node = Y.one(element).one('span'); |
2019 | } else if (current_field == 'self_link') { |
2020 | picker._resource_uri = element.innerHTML; |
2021 | } |
2022 | @@ -230,7 +230,7 @@ |
2023 | |
2024 | picker.subscribe('save', function (e) { |
2025 | Y.log('Got save event.'); |
2026 | - // Y.get() uses CSS3 selectors which don't work with ids containing |
2027 | + // Y.one() uses CSS3 selectors which don't work with ids containing |
2028 | // a period, so we have to use Y.DOM.byId(). |
2029 | save(e.details[Y.Picker.SAVE_RESULT]); |
2030 | }); |
2031 | |
2032 | === modified file 'lib/canonical/launchpad/javascript/lp/tests/test_lp_collapsibles.js' |
2033 | --- lib/canonical/launchpad/javascript/lp/tests/test_lp_collapsibles.js 2009-07-08 17:21:50 +0000 |
2034 | +++ lib/canonical/launchpad/javascript/lp/tests/test_lp_collapsibles.js 2009-11-18 13:45:26 +0000 |
2035 | @@ -39,7 +39,7 @@ |
2036 | this.default_fieldset_content_node)); |
2037 | |
2038 | // Reset the container to its default contents. |
2039 | - this.container = Y.get('#container-of-stuff'); |
2040 | + this.container = Y.one('#container-of-stuff'); |
2041 | this.container.set('innerHTML', ''); |
2042 | this.container.appendChild( |
2043 | this.default_fieldset_node.cloneNode( |
2044 | @@ -51,7 +51,7 @@ |
2045 | // business of toggling the collapsible open and shut. |
2046 | Y.lp.activate_collapsibles(); |
2047 | |
2048 | - var anchor = this.container.query('a'); |
2049 | + var anchor = this.container.one('a'); |
2050 | Assert.isNotNull( |
2051 | anchor, "activate_collapsibles() should create an anchor"); |
2052 | |
2053 | @@ -65,8 +65,8 @@ |
2054 | // creates. |
2055 | Y.lp.activate_collapsibles(); |
2056 | |
2057 | - var anchor = this.container.query('a'); |
2058 | - var icon = anchor.query('img'); |
2059 | + var anchor = this.container.one('a'); |
2060 | + var icon = anchor.one('img'); |
2061 | |
2062 | Assert.isNotNull( |
2063 | icon, |
2064 | @@ -83,8 +83,8 @@ |
2065 | // activate_collapsibles() adds a span to the anchor it creates. |
2066 | Y.lp.activate_collapsibles(); |
2067 | |
2068 | - var anchor = this.container.query('a'); |
2069 | - var span = anchor.query('span'); |
2070 | + var anchor = this.container.one('a'); |
2071 | + var span = anchor.one('span'); |
2072 | |
2073 | Assert.isNotNull( |
2074 | span, |
2075 | @@ -108,22 +108,22 @@ |
2076 | wrapper_div, |
2077 | "activate_collapsibles() should add a wrapper div"); |
2078 | |
2079 | - var collapsible = this.container.query('.collapsible'); |
2080 | + var collapsible = this.container.one('.collapsible'); |
2081 | Assert.isNotNull( |
2082 | - collapsible.query('.collapseWrapper'), |
2083 | + collapsible.one('.collapseWrapper'), |
2084 | "The collapseWrapper div should be within the collapsible."); |
2085 | }, |
2086 | |
2087 | test_activate_collapsibles_collapses_collapsed: function() { |
2088 | // If a collapsible has the class 'collapsed', |
2089 | // activate_collapsibles() will pre-collapse it. |
2090 | - var collapsible = this.container.query('.collapsible'); |
2091 | + var collapsible = this.container.one('.collapsible'); |
2092 | collapsible.addClass('collapsed'); |
2093 | |
2094 | Y.lp.activate_collapsibles(); |
2095 | |
2096 | - var icon = collapsible.query('img'); |
2097 | - var wrapper_div = collapsible.query('.collapseWrapper'); |
2098 | + var icon = collapsible.one('img'); |
2099 | + var wrapper_div = collapsible.one('.collapseWrapper'); |
2100 | this.wait(function() { |
2101 | Assert.isTrue(wrapper_div.hasClass('lazr-closed')); |
2102 | Assert.areNotEqual( |
2103 | @@ -136,9 +136,9 @@ |
2104 | // won't be pre-collapsed. |
2105 | Y.lp.activate_collapsibles(); |
2106 | |
2107 | - var collapsible = this.container.query('.collapsible'); |
2108 | - var icon = collapsible.query('img'); |
2109 | - var wrapper_div = collapsible.query('.collapseWrapper'); |
2110 | + var collapsible = this.container.one('.collapsible'); |
2111 | + var icon = collapsible.one('img'); |
2112 | + var wrapper_div = collapsible.one('.collapseWrapper'); |
2113 | this.wait(function() { |
2114 | Assert.isFalse(wrapper_div.hasClass('lazr-closed')); |
2115 | Assert.areNotEqual( |
2116 | @@ -149,7 +149,7 @@ |
2117 | test_toggle_collapsible_opens_collapsed_collapsible: function() { |
2118 | // Calling toggle_collapsible() on a collapsed collapsible will |
2119 | // toggle its state to open. |
2120 | - var collapsible = this.container.query('.collapsible'); |
2121 | + var collapsible = this.container.one('.collapsible'); |
2122 | collapsible.addClass('collapsed'); |
2123 | |
2124 | Y.lp.activate_collapsibles(); |
2125 | @@ -157,8 +157,8 @@ |
2126 | this.wait(function() { |
2127 | |
2128 | // The collapsible's wrapper div will now be open. |
2129 | - var icon = collapsible.query('img'); |
2130 | - var wrapper_div = collapsible.query('.collapseWrapper'); |
2131 | + var icon = collapsible.one('img'); |
2132 | + var wrapper_div = collapsible.one('.collapseWrapper'); |
2133 | Assert.isTrue(wrapper_div.hasClass('lazr-open')); |
2134 | Assert.areNotEqual( |
2135 | -1, icon.get('src').indexOf('/@@/treeExpanded'); |
2136 | @@ -168,15 +168,15 @@ |
2137 | test_toggle_collapsible_closes_open_collapsible: function() { |
2138 | // Calling toggle_collapsible() on an open collapsible will |
2139 | // toggle its state to closed. |
2140 | - var collapsible = this.container.query('.collapsible'); |
2141 | + var collapsible = this.container.one('.collapsible'); |
2142 | |
2143 | Y.lp.activate_collapsibles(); |
2144 | Y.lp.toggle_collapsible(collapsible); |
2145 | |
2146 | this.wait(function() { |
2147 | // The collapsible's wrapper div will now be closed. |
2148 | - var icon = collapsible.query('img'); |
2149 | - var wrapper_div = collapsible.query('.collapseWrapper'); |
2150 | + var icon = collapsible.one('img'); |
2151 | + var wrapper_div = collapsible.one('.collapseWrapper'); |
2152 | Assert.isTrue(wrapper_div.hasClass('lazr-closed')); |
2153 | Assert.areNotEqual( |
2154 | -1, icon.get('src').indexOf('/@@/treeCollapsed')); |
2155 | @@ -220,13 +220,13 @@ |
2156 | ' <p>No legend!</p>' + |
2157 | '</fieldset>'); |
2158 | |
2159 | - var valid_collapsible = this.container.query('.collapsible'); |
2160 | + var valid_collapsible = this.container.one('.collapsible'); |
2161 | this.container.insertBefore(invalid_collapsible, valid_collapsible); |
2162 | Y.lp.activate_collapsibles(); |
2163 | |
2164 | // The standard, valid collapsible is still set up correctly. |
2165 | Assert.isNotNull( |
2166 | - valid_collapsible.query('.collapseWrapper'), |
2167 | + valid_collapsible.one('.collapseWrapper'), |
2168 | "activate_collapsibles() should have added a wrapper div for " + |
2169 | "the valid collapsible."); |
2170 | }, |
2171 | @@ -243,9 +243,9 @@ |
2172 | } |
2173 | |
2174 | Y.lp.activate_collapsibles(); |
2175 | - Y.each(Y.all('.collapsible'), function(collapsible) { |
2176 | + Y.all('.collapsible').each(function(collapsible) { |
2177 | Assert.isNotNull( |
2178 | - collapsible.query('.collapseWrapper'), |
2179 | + collapsible.one('.collapseWrapper'), |
2180 | "activate_collapsibles() should have added a wrapper div " + |
2181 | "to all collapsibles."); |
2182 | }); |
2183 | @@ -279,9 +279,9 @@ |
2184 | this.container.appendChild(new_collapsible); |
2185 | Y.lp.activate_collapsibles(); |
2186 | |
2187 | - var collapsible = this.container.query('.collapsible'); |
2188 | + var collapsible = this.container.one('.collapsible'); |
2189 | Assert.isNull( |
2190 | - this.container.query('#should-be-removed'), |
2191 | + this.container.one('#should-be-removed'), |
2192 | "The should-be-removed link should have been removed"); |
2193 | }, |
2194 | |
2195 | @@ -289,24 +289,24 @@ |
2196 | // If activate_collapsibles() has already been called, calling |
2197 | // it again won't break the existing collapsibles. |
2198 | Y.lp.activate_collapsibles(); |
2199 | - var collapsible = this.container.query('.collapsible'); |
2200 | - var anchor = collapsible.query('a'); |
2201 | - var span = anchor.query('span'); |
2202 | + var collapsible = this.container.one('.collapsible'); |
2203 | + var anchor = collapsible.one('a'); |
2204 | + var span = anchor.one('span'); |
2205 | var original_span_contents = span.get('innerHTML'); |
2206 | - var wrapper = collapsible.query('.collapseWrapper'); |
2207 | + var wrapper = collapsible.one('.collapseWrapper'); |
2208 | var original_wrapper_contents = wrapper.get('innerHTML'); |
2209 | |
2210 | // Calling activate_collapsibles() shouldn't break things. |
2211 | Y.lp.activate_collapsibles(); |
2212 | - collapsible = this.container.query('.collapsible'); |
2213 | - anchor = collapsible.query('a'); |
2214 | - span = anchor.query('span'); |
2215 | - wrapper = collapsible.query('.collapseWrapper'); |
2216 | + collapsible = this.container.one('.collapsible'); |
2217 | + anchor = collapsible.one('a'); |
2218 | + span = anchor.one('span'); |
2219 | + wrapper = collapsible.one('.collapseWrapper'); |
2220 | |
2221 | Assert.isNotNull( |
2222 | anchor, "Existing collapsibles' anchors should be intact."); |
2223 | |
2224 | - var icon = anchor.query('img'); |
2225 | + var icon = anchor.one('img'); |
2226 | Assert.isNotNull( |
2227 | icon, |
2228 | "Existing collapsibles' icons should be intact."); |
2229 | |
2230 | === modified file 'lib/canonical/launchpad/javascript/registry/milestone_table.js' |
2231 | --- lib/canonical/launchpad/javascript/registry/milestone_table.js 2009-06-19 20:35:13 +0000 |
2232 | +++ lib/canonical/launchpad/javascript/registry/milestone_table.js 2009-11-18 13:45:26 +0000 |
2233 | @@ -101,7 +101,7 @@ |
2234 | "Undefined properties in setup config for milestonetable."); |
2235 | } |
2236 | self._milestone_row_uri_template = config.milestone_row_uri_template; |
2237 | - self._tbody = Y.get(config.milestone_rows_id); |
2238 | + self._tbody = Y.one(config.milestone_rows_id); |
2239 | if (self._tbody === null) { |
2240 | throw new Error( |
2241 | Y.substitute("'{milestone_rows_id}' not in page.", config)); |
2242 | |
2243 | === modified file 'lib/canonical/launchpad/javascript/registry/milestoneoverlay.js' |
2244 | --- lib/canonical/launchpad/javascript/registry/milestoneoverlay.js 2009-08-13 13:36:02 +0000 |
2245 | +++ lib/canonical/launchpad/javascript/registry/milestoneoverlay.js 2009-11-18 13:45:26 +0000 |
2246 | @@ -32,7 +32,7 @@ |
2247 | milestone_form.clearError(); |
2248 | milestone_form.hide(); |
2249 | // Reset the HTML form inside the widget. |
2250 | - milestone_form.get('contentBox').query('form').reset(); |
2251 | + milestone_form.get('contentBox').one('form').reset(); |
2252 | next_step(parameters); |
2253 | }; |
2254 | |
2255 | @@ -42,7 +42,7 @@ |
2256 | on: { |
2257 | success: finish_new_milestone, |
2258 | failure: function (ignore, response, args) { |
2259 | - var error_box = Y.get('#milestone-error'); |
2260 | + var error_box = Y.one('#milestone-error'); |
2261 | var error_message = '<strong>' + response.statusText + |
2262 | '</strong><p>' + |
2263 | response.responseText + |
2264 | |
2265 | === modified file 'lib/canonical/launchpad/javascript/registry/tests/test_milestone_table.js' |
2266 | --- lib/canonical/launchpad/javascript/registry/tests/test_milestone_table.js 2009-06-19 18:31:25 +0000 |
2267 | +++ lib/canonical/launchpad/javascript/registry/tests/test_milestone_table.js 2009-11-18 13:45:26 +0000 |
2268 | @@ -21,7 +21,7 @@ |
2269 | }, |
2270 | |
2271 | setUp: function() { |
2272 | - this.tbody = Y.get('#milestone-rows'); |
2273 | + this.tbody = Y.one('#milestone-rows'); |
2274 | }, |
2275 | |
2276 | tearDown: function() { |
2277 | @@ -71,7 +71,7 @@ |
2278 | name: '_setup_milestone_event_data', |
2279 | |
2280 | setUp: function() { |
2281 | - this.tbody = Y.get('#milestone-rows'); |
2282 | + this.tbody = Y.one('#milestone-rows'); |
2283 | }, |
2284 | |
2285 | tearDown: function() { |
2286 | @@ -155,7 +155,7 @@ |
2287 | |
2288 | setUp: function() { |
2289 | this.data = milestonetable._setup_milestone_event_data( |
2290 | - {name: '0.1'}, Y.get('#milestone-rows')); |
2291 | + {name: '0.1'}, Y.one('#milestone-rows')); |
2292 | }, |
2293 | |
2294 | tearDown: function() { |
2295 | @@ -181,7 +181,7 @@ |
2296 | this.response = { |
2297 | responseText: " <tr><td>" + this.success + "<td></tr> "}; |
2298 | this.data = milestonetable._setup_milestone_event_data( |
2299 | - {name: '0.1'}, Y.get('#milestone-rows')); |
2300 | + {name: '0.1'}, Y.one('#milestone-rows')); |
2301 | // Needed to reset the DOM. |
2302 | this.table = this.data.tbody.ancestor(); |
2303 | this.tbody_markup = this.table.get('innerHTML'); |
2304 | |
2305 | === modified file 'lib/canonical/launchpad/javascript/registry/tests/timeline.js' |
2306 | --- lib/canonical/launchpad/javascript/registry/tests/timeline.js 2009-10-06 22:11:50 +0000 |
2307 | +++ lib/canonical/launchpad/javascript/registry/tests/timeline.js 2009-11-18 13:45:26 +0000 |
2308 | @@ -76,7 +76,7 @@ |
2309 | */ |
2310 | function simulate(widget, selector, evtype, options) { |
2311 | var bounding_box = widget.get('boundingBox'); |
2312 | - var rawnode = Y.Node.getDOMNode(bounding_box.query(selector)); |
2313 | + var rawnode = Y.Node.getDOMNode(bounding_box.one(selector)); |
2314 | Y.Event.simulate(rawnode, evtype, options); |
2315 | } |
2316 | |
2317 | @@ -104,24 +104,24 @@ |
2318 | "TimelineGraph was not created."); |
2319 | |
2320 | Assert.isNotNull( |
2321 | - this.content_box.query('canvas'), |
2322 | + this.content_box.one('canvas'), |
2323 | "A canvas should have been created."); |
2324 | }, |
2325 | |
2326 | test_zoom_buttons: function() { |
2327 | - var zoom_in = this.content_box.query('a.yui-timelinegraph-zoom-in'); |
2328 | + var zoom_in = this.content_box.one('a.yui-timelinegraph-zoom-in'); |
2329 | Assert.isNotNull( |
2330 | zoom_in, |
2331 | 'zoom_in link not found.'); |
2332 | |
2333 | - var zoom_out = this.content_box.query('a.yui-timelinegraph-zoom-out'); |
2334 | + var zoom_out = this.content_box.one('a.yui-timelinegraph-zoom-out'); |
2335 | Assert.isNotNull( |
2336 | zoom_in, |
2337 | 'zoom_out link not found.'); |
2338 | }, |
2339 | |
2340 | test_series_label: function() { |
2341 | - var label = this.content_box.query('div#trunk'); |
2342 | + var label = this.content_box.one('div#trunk'); |
2343 | Assert.isNotNull( |
2344 | label, |
2345 | "Series label not found."); |
2346 | @@ -130,7 +130,7 @@ |
2347 | label.get('title'), |
2348 | "Unexpected series label title."); |
2349 | |
2350 | - var link = label.query('a'); |
2351 | + var link = label.one('a'); |
2352 | Assert.isNotNull( |
2353 | link, |
2354 | "Series label does not contain a link."); |
2355 | @@ -163,8 +163,8 @@ |
2356 | }, |
2357 | |
2358 | test_milestone_label_second_line: function() { |
2359 | - var label = this.content_box.query('div#ski'); |
2360 | - var second_line = label.query('div'); |
2361 | + var label = this.content_box.one('div#ski'); |
2362 | + var second_line = label.one('div'); |
2363 | Assert.areEqual( |
2364 | '2200-05-26', |
2365 | second_line.get('innerHTML'), |
2366 | @@ -180,7 +180,7 @@ |
2367 | 'This test must be run in an iframe with id=' + |
2368 | this.timeline_graph.resize_frame + '.'); |
2369 | |
2370 | - var canvas = this.content_box.query('canvas'); |
2371 | + var canvas = this.content_box.one('canvas'); |
2372 | var first_canvas_height = canvas.get('offsetHeight'); |
2373 | Assert.areEqual(1, this.timeline_graph.graph_scale); |
2374 | Assert.areEqual( |
2375 | @@ -192,7 +192,7 @@ |
2376 | |
2377 | // The canvas is recreated in order to |
2378 | // resize correctly in all browsers. |
2379 | - canvas = this.content_box.query('canvas'); |
2380 | + canvas = this.content_box.one('canvas'); |
2381 | Assert.areEqual(1.1, this.timeline_graph.graph_scale); |
2382 | Assert.areEqual( |
2383 | canvas.get('offsetHeight'), frame.height, |
2384 | @@ -204,7 +204,7 @@ |
2385 | simulate( |
2386 | this.timeline_graph, '.yui-timelinegraph-zoom-out', 'click'); |
2387 | |
2388 | - canvas = this.content_box.query('canvas'); |
2389 | + canvas = this.content_box.one('canvas'); |
2390 | Assert.areEqual(1, this.timeline_graph.graph_scale); |
2391 | Assert.areEqual( |
2392 | canvas.get('offsetHeight'), frame.height, |
2393 | @@ -230,7 +230,7 @@ |
2394 | }, |
2395 | |
2396 | test_milestone_label: function() { |
2397 | - var label = this.content_box.query('div#alpha'); |
2398 | + var label = this.content_box.one('div#alpha'); |
2399 | Assert.isNotNull( |
2400 | label, |
2401 | "Milestone label not found."); |
2402 | @@ -239,7 +239,7 @@ |
2403 | label.get('title'), |
2404 | "Unexpected milestone label title."); |
2405 | |
2406 | - var link = label.query('a'); |
2407 | + var link = label.one('a'); |
2408 | Assert.isNotNull( |
2409 | link, |
2410 | "Milestone label does not contain a link."); |
2411 | @@ -253,7 +253,7 @@ |
2412 | link.get('href'), |
2413 | "Unexpected milestone link href."); |
2414 | |
2415 | - var second_line = label.query('div'); |
2416 | + var second_line = label.one('div'); |
2417 | Assert.isNull( |
2418 | second_line, |
2419 | "There should be no second line for landmarks when " + |
2420 | |
2421 | === modified file 'lib/canonical/launchpad/javascript/soyuz/archivesubscribers_index.js' |
2422 | --- lib/canonical/launchpad/javascript/soyuz/archivesubscribers_index.js 2009-09-29 07:26:40 +0000 |
2423 | +++ lib/canonical/launchpad/javascript/soyuz/archivesubscribers_index.js 2009-11-18 13:45:26 +0000 |
2424 | @@ -18,22 +18,22 @@ |
2425 | Y.soyuz.setup_archivesubscribers_index = function() { |
2426 | // If there are no errors then we hide the add-subscriber row and |
2427 | // potentially the whole table if there are no subscribers. |
2428 | - if (Y.Lang.isNull(Y.get('p.error.message'))) { |
2429 | + if (Y.Lang.isNull(Y.one('p.error.message'))) { |
2430 | |
2431 | // Hide the add-subscriber row. |
2432 | - var add_subscriber_row = Y.get( |
2433 | + var add_subscriber_row = Y.one( |
2434 | '#archive-subscribers .add-subscriber'); |
2435 | add_subscriber_row.setStyle('display', 'none'); |
2436 | |
2437 | // If there are no subscribers, then hide the complete section. |
2438 | - var subscribers = Y.get('#subscribers'); |
2439 | - if (Y.Lang.isObject(Y.get('#no-subscribers'))) { |
2440 | + var subscribers = Y.one('#subscribers'); |
2441 | + if (Y.Lang.isObject(Y.one('#no-subscribers'))) { |
2442 | subscribers.setStyle('display', 'none'); |
2443 | } |
2444 | } |
2445 | |
2446 | // Add a link to open the add-subscriber row. |
2447 | - var placeholder = Y.get('#add-subscriber-placeholder'); |
2448 | + var placeholder = Y.one('#add-subscriber-placeholder'); |
2449 | placeholder.set( |
2450 | 'innerHTML', |
2451 | '<a class="js-action sprite add" href="#">Add access</a>'); |
2452 | |
2453 | === modified file 'lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js' |
2454 | --- lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js 2009-06-30 21:06:27 +0000 |
2455 | +++ lib/canonical/launchpad/javascript/soyuz/lp_dynamic_dom_updater.js 2009-11-18 13:45:26 +0000 |
2456 | @@ -19,7 +19,7 @@ |
2457 | * expected format. |
2458 | * |
2459 | * For example: |
2460 | - * var table = Y.get('table#build-count-table'); |
2461 | + * var table = Y.one('table#build-count-table'); |
2462 | * var config = { |
2463 | * domUpdateFunction: updateArchiveBuildStatusSummary |
2464 | * } |
2465 | @@ -93,7 +93,7 @@ |
2466 | * into a DOM subtree so that it can update itself using an LP api method. |
2467 | * |
2468 | * For example: |
2469 | - * var table = Y.get('table#build-count-table'); |
2470 | + * var table = Y.one('table#build-count-table'); |
2471 | * var config = { |
2472 | * domUpdateFunction: updateArchiveBuildStatusSummary, |
2473 | * uri: LP.client.cache.context.self_link, |
2474 | |
2475 | === modified file 'lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js' |
2476 | --- lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js 2009-09-30 06:40:29 +0000 |
2477 | +++ lib/canonical/launchpad/javascript/soyuz/tests/archivesubscribers_index.js 2009-11-18 13:45:26 +0000 |
2478 | @@ -17,12 +17,12 @@ |
2479 | name: 'add-subscriber', |
2480 | |
2481 | setUp: function() { |
2482 | - this.add_subscriber_placeholder = Y.get( |
2483 | + this.add_subscriber_placeholder = Y.one( |
2484 | '#add-subscriber-placeholder'); |
2485 | - this.archive_subscribers_table_body = Y.get( |
2486 | - '#archive-subscribers').query('tbody'); |
2487 | - this.error_div = Y.get('#errors'); |
2488 | - this.subscribers_div = Y.get('#subscribers'); |
2489 | + this.archive_subscribers_table_body = Y.one( |
2490 | + '#archive-subscribers').one('tbody'); |
2491 | + this.error_div = Y.one('#errors'); |
2492 | + this.subscribers_div = Y.one('#subscribers'); |
2493 | |
2494 | |
2495 | // Ensure there are no errors displayed. |
2496 | @@ -48,7 +48,7 @@ |
2497 | '</tr>' |
2498 | ].join('')); |
2499 | |
2500 | - this.add_subscriber_row = Y.get( |
2501 | + this.add_subscriber_row = Y.one( |
2502 | '#archive-subscribers .add-subscriber'); |
2503 | }, |
2504 | |
2505 | @@ -120,7 +120,7 @@ |
2506 | test_click_add_access_displays_add_row: function() { |
2507 | // The add subscriber row is displayed after clicking 'Add access'. |
2508 | Y.soyuz.setup_archivesubscribers_index(); |
2509 | - var link_node = this.add_subscriber_placeholder.query('a'); |
2510 | + var link_node = this.add_subscriber_placeholder.one('a'); |
2511 | Assert.areEqual( |
2512 | 'Add access', link_node.get('innerHTML')); |
2513 | |
2514 | |
2515 | === modified file 'lib/canonical/launchpad/javascript/soyuz/update_archive_build_statuses.js' |
2516 | --- lib/canonical/launchpad/javascript/soyuz/update_archive_build_statuses.js 2009-08-28 16:06:56 +0000 |
2517 | +++ lib/canonical/launchpad/javascript/soyuz/update_archive_build_statuses.js 2009-11-18 13:45:26 +0000 |
2518 | @@ -36,16 +36,14 @@ |
2519 | * @config domUpdateFunction |
2520 | */ |
2521 | domUpdateFunction: function(portlet_node, data_object){ |
2522 | - var counter_nodelist = portlet_node.queryAll('.build-count'); |
2523 | - |
2524 | // For each node of the counter node in the portlet: |
2525 | - counter_nodelist.each(function(node){ |
2526 | + portlet_node.all('.build-count').each(function(node){ |
2527 | // Check whether the node has a class matching the data name |
2528 | // of the passed in data, and if so, set the innerHTML to |
2529 | // the corresponding value. |
2530 | Y.each(data_object, function(data_value, data_name){ |
2531 | if (node.hasClass(data_name)){ |
2532 | - previous_value = node.get("innerHTML"); |
2533 | + var previous_value = node.get("innerHTML"); |
2534 | node.set("innerHTML", data_value); |
2535 | // If the value changed, just put a quick anim |
2536 | // on the parent row. |
2537 | @@ -69,7 +67,7 @@ |
2538 | */ |
2539 | stopUpdatesCheckFunction: function(portlet_node){ |
2540 | // Stop updating only when there are zero pending builds: |
2541 | - var pending_elem = portlet_node.query(".pending"); |
2542 | + var pending_elem = portlet_node.one(".pending"); |
2543 | if (pending_elem === null){ |
2544 | return true; |
2545 | } |
2546 | @@ -85,7 +83,7 @@ |
2547 | Y.on("domready", function(){ |
2548 | // Grab the Archive build count portlet and tell it how to |
2549 | // update itself: |
2550 | - var portlet = Y.get('div#build-status-summary'); |
2551 | + var portlet = Y.one('div#build-status-summary'); |
2552 | build_summary_portlet_dynamic_update_config.uri = |
2553 | LP.client.cache.context.self_link; |
2554 | portlet.plug(Y.lp.DynamicDomUpdater, |
2555 | @@ -114,7 +112,7 @@ |
2556 | Y.each(data_object, function(build_summary, source_id){ |
2557 | // Grab the related td element (and fail silently if it doesn't |
2558 | // exist). |
2559 | - var td_elem = Y.get("#pubstatus" + source_id); |
2560 | + var td_elem = Y.one("#pubstatus" + source_id); |
2561 | if (td_elem === null) { |
2562 | return; |
2563 | } |
2564 | @@ -122,7 +120,7 @@ |
2565 | // We'll need to remember whether we've change the UI so that |
2566 | // we can add a flash at the end if we do: |
2567 | var td_ui_changed = false; |
2568 | - var img_node = td_elem.query('img'); |
2569 | + var img_node = td_elem.one('img'); |
2570 | |
2571 | // If the status has changed then we need to update the td |
2572 | // element's class and image: |
2573 | @@ -145,12 +143,12 @@ |
2574 | switch(build_summary.status) { |
2575 | case 'BUILDING': |
2576 | new_src = '/@@/processing'; |
2577 | - new_title = 'There are some builds currently ' + |
2578 | + new_title = 'There are some builds currently ' + |
2579 | 'building.'; |
2580 | break; |
2581 | case 'NEEDSBUILD': |
2582 | new_src = '/@@/build-needed'; |
2583 | - new_title = 'There are some builds waiting to ' + |
2584 | + new_title = 'There are some builds waiting to ' + |
2585 | 'be built.'; |
2586 | break; |
2587 | case 'FAILEDTOBUILD': |
2588 | @@ -215,7 +213,7 @@ |
2589 | }, |
2590 | |
2591 | /** |
2592 | - * This function evaluates the parameters required for the |
2593 | + * This function evaluates the parameters required for the |
2594 | * getBuildSummariesForSourceIds api function, using the current |
2595 | * state of the DOM subtree (ie. It finds the ids of builds in the |
2596 | * subtree that are have a class of either NEEDSBUILD or BUILDING.) |
2597 | @@ -225,14 +223,14 @@ |
2598 | parameterEvaluatorFunction: function(table_node){ |
2599 | // Grab all the td's with the class 'build_status' and an additional |
2600 | // class of either 'NEEDSBUILD' or 'BUILDING': |
2601 | - // Note: filter('.NEEDSBUILD, .BUILDING') returns [] |
2602 | - var td_list = table_node.queryAll('td.build_status'); |
2603 | + var td_list = table_node.all('td.build_status'); |
2604 | var tds_needsbuild = td_list.filter(".NEEDSBUILD"); |
2605 | var tds_building = td_list.filter(".BUILDING"); |
2606 | var tds_fullybuilt_pending = td_list.filter(".FULLYBUILT_PENDING"); |
2607 | |
2608 | - if (tds_needsbuild.length === 0 && tds_building.length === 0 && |
2609 | - tds_fullybuilt_pending.length === 0) { |
2610 | + if (tds_needsbuild.size() === 0 && |
2611 | + tds_building.size() === 0 && |
2612 | + tds_fullybuilt_pending.size() === 0) { |
2613 | return null; |
2614 | } |
2615 | |
2616 | @@ -259,10 +257,10 @@ |
2617 | */ |
2618 | stopUpdatesCheckFunction: function(table_node){ |
2619 | // Stop updating only when there aren't any sources to update: |
2620 | - var td_list = table_node.queryAll('td.build_status'); |
2621 | - return (td_list.filter(".NEEDSBUILD").length === 0 && |
2622 | - td_list.filter(".BUILDING").length === 0 && |
2623 | - td_list.filter(".FULLYBUILT_PENDING").length === 0); |
2624 | + var td_list = table_node.all('td.build_status'); |
2625 | + return (td_list.filter(".NEEDSBUILD").size() === 0 && |
2626 | + td_list.filter(".BUILDING").size() === 0 && |
2627 | + td_list.filter(".FULLYBUILT_PENDING").size() === 0); |
2628 | } |
2629 | }; |
2630 | |
2631 | @@ -273,7 +271,7 @@ |
2632 | // Grab the packages table and tell it how to update itself. |
2633 | // Note: there are situations, such as displaying empty result |
2634 | // sets, when the table will not be on the page. |
2635 | - var table = Y.get('table#packages_list'); |
2636 | + var table = Y.one('table#packages_list'); |
2637 | if (table !== null) { |
2638 | source_package_table_dynamic_update_config.uri = |
2639 | LP.client.cache.context.self_link; |
2640 | |
2641 | === modified file 'lib/canonical/launchpad/javascript/translations/translations.js' |
2642 | --- lib/canonical/launchpad/javascript/translations/translations.js 2009-10-01 11:10:51 +0000 |
2643 | +++ lib/canonical/launchpad/javascript/translations/translations.js 2009-11-18 13:45:26 +0000 |
2644 | @@ -103,7 +103,7 @@ |
2645 | table.insertBefore(output, row.next()); |
2646 | |
2647 | var entry_uri = '+imports/' + entry_id; |
2648 | - var div = output.query('div'); |
2649 | + var div = output.one('div'); |
2650 | var lp = new LP.client.Launchpad(); |
2651 | lp.get(entry_uri, output_loader(div)); |
2652 | }; |
2653 | |
2654 | === modified file 'lib/lp/app/templates/base-layout-macros.pt' |
2655 | --- lib/lp/app/templates/base-layout-macros.pt 2009-11-10 21:49:38 +0000 |
2656 | +++ lib/lp/app/templates/base-layout-macros.pt 2009-11-18 13:45:26 +0000 |
2657 | @@ -43,7 +43,7 @@ |
2658 | rooturl modules/canonical.launchpad.webapp.vhosts/allvhosts/configs/mainsite/rooturl; |
2659 | icingroot string:${rooturl}+icing/rev${revno}; |
2660 | devmode modules/canonical.config/config/devmode; |
2661 | - yui string:${icingroot}/yui/3.0.0pr2/build; |
2662 | + yui string:${icingroot}/yui/current/build; |
2663 | lazr_js string:${icingroot}/lazr/build; |
2664 | lp_js string:${icingroot}/build" |
2665 | > |
2666 | @@ -53,17 +53,45 @@ |
2667 | </tal:comment> |
2668 | |
2669 | <tal:devmode condition="devmode"> |
2670 | - <script type="text/javascript" |
2671 | - tal:attributes="src string:${yui}/yui/yui.js"></script> |
2672 | + |
2673 | + <tal:comment replace="nothing"> |
2674 | + Instead of loading the yui.js seed we will load three of it's five |
2675 | + sub-components. |
2676 | + |
2677 | + We leave out get.js and loader.js, effectively disabling |
2678 | + dynamic loading of modules. |
2679 | + |
2680 | + XXX mars 2009-11-03 |
2681 | + To see what modules are missing you have to change yui-base.js to |
2682 | + yui-base-debug.js and move the <script/> node outside of this block. |
2683 | + |
2684 | + This will hopefully be fixed in YUI itself. |
2685 | + See http://yuilibrary.com/projects/yui3/ticket/2528368 |
2686 | + </tal:comment> |
2687 | + <script type="text/javascript" |
2688 | + tal:attributes="src string:${yui}/yui/yui-base.js"></script> |
2689 | + <script type="text/javascript" |
2690 | + tal:attributes="src string:${yui}/yui/yui-log.js"></script> |
2691 | + <script type="text/javascript" |
2692 | + tal:attributes="src string:${yui}/yui/yui-later.js"></script> |
2693 | + |
2694 | <script type="text/javascript" |
2695 | tal:attributes="src string:${yui}/oop/oop.js"></script> |
2696 | <script type="text/javascript" |
2697 | tal:attributes="src string:${yui}/event/event.js"></script> |
2698 | <script type="text/javascript" |
2699 | + tal:attributes="src string:${yui}/event-custom/event-custom.js"></script> |
2700 | + <script type="text/javascript" |
2701 | + tal:attributes="src string:${yui}/event-simulate/event-simulate.js"></script> |
2702 | + <script type="text/javascript" |
2703 | tal:attributes="src string:${yui}/dom/dom.js"></script> |
2704 | <script type="text/javascript" |
2705 | tal:attributes="src string:${yui}/node/node.js"></script> |
2706 | <script type="text/javascript" |
2707 | + tal:attributes="src string:${yui}/node-focusmanager/node-focusmanager.js"></script> |
2708 | + <script type="text/javascript" |
2709 | + tal:attributes="src string:${yui}/node/node-event-simulate.js"></script> |
2710 | + <script type="text/javascript" |
2711 | tal:attributes="src string:${yui}/dump/dump.js"></script> |
2712 | <script type="text/javascript" |
2713 | tal:attributes="src string:${yui}/io/io.js"></script> |
2714 | @@ -82,6 +110,8 @@ |
2715 | <script type="text/javascript" |
2716 | tal:attributes="src string:${yui}/plugin/plugin.js"></script> |
2717 | <script type="text/javascript" |
2718 | + tal:attributes="src string:${yui}/pluginhost/pluginhost.js"></script> |
2719 | + <script type="text/javascript" |
2720 | tal:attributes="src string:${yui}/widget/widget.js"></script> |
2721 | <script type="text/javascript" |
2722 | tal:attributes="src string:${yui}/widget/widget-position-ext.js"></script> |
2723 | @@ -267,7 +297,7 @@ |
2724 | revno modules/canonical.launchpad.versioninfo/revno | string:unknown; |
2725 | rooturl modules/canonical.launchpad.webapp.vhosts/allvhosts/configs/mainsite/rooturl; |
2726 | icingroot string:${rooturl}+icing/rev${revno}; |
2727 | - yui string:${icingroot}/yui/3.0.0pr2/build; |
2728 | + yui string:${icingroot}/yui/current/build; |
2729 | devmode modules/canonical.config/config/devmode"> |
2730 | <tal:comment replace="nothing"> |
2731 | This macro loads the old stylesheet, then the YUI CSS, and finally |
2732 | |
2733 | === modified file 'lib/lp/app/templates/base-layout.pt' |
2734 | --- lib/lp/app/templates/base-layout.pt 2009-09-23 10:17:34 +0000 |
2735 | +++ lib/lp/app/templates/base-layout.pt 2009-11-18 13:45:26 +0000 |
2736 | @@ -24,7 +24,7 @@ |
2737 | xmlns:i18n="http://xml.zope.org/namespaces/i18n" |
2738 | xml:lang="en" lang="en" dir="ltr"> |
2739 | <head tal:define=" |
2740 | - yui string:${icingroot}/yui/3.0.0pr2/build; |
2741 | + yui string:${icingroot}/yui/current/build; |
2742 | lazr_js string:${icingroot}/lazr/build; |
2743 | lp_js string:${icingroot}/build"> |
2744 | <title tal:content="view/fmt:pagetitle">Page Title</title> |
2745 | |
2746 | === modified file 'lib/lp/bugs/templates/bug-portlet-subscribers.pt' |
2747 | --- lib/lp/bugs/templates/bug-portlet-subscribers.pt 2009-11-05 14:56:01 +0000 |
2748 | +++ lib/lp/bugs/templates/bug-portlet-subscribers.pt 2009-11-18 13:45:26 +0000 |
2749 | @@ -25,7 +25,7 @@ |
2750 | YUI().use('io-base', 'node', 'bugs.bugtask_index', function(Y) { |
2751 | // Must be done inline here to ensure the load event fires. |
2752 | // This is a work around for a YUI3 issue with event handling. |
2753 | - var subscription_link = Y.get('.menu-link-subscription'); |
2754 | + var subscription_link = Y.one('.menu-link-subscription'); |
2755 | var subscription_link_handler; |
2756 | if (subscription_link) { |
2757 | subscription_link_handler = subscription_link.on('click', function(e) { |
2758 | |
2759 | === modified file 'lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt' |
2760 | --- lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt 2009-07-17 17:59:07 +0000 |
2761 | +++ lib/lp/bugs/templates/bugtarget-portlet-bugfilters.pt 2009-11-18 13:45:25 +0000 |
2762 | @@ -14,11 +14,11 @@ |
2763 | <script type="text/javascript"> |
2764 | YUI().use('io-base', 'node', function(Y) { |
2765 | Y.on('domready', function() { |
2766 | - var portlet = Y.get('#portlet-bugfilters'); |
2767 | - Y.get('#bugfilters-portlet-spinner').setStyle('display', 'block'); |
2768 | + var portlet = Y.one('#portlet-bugfilters'); |
2769 | + Y.one('#bugfilters-portlet-spinner').setStyle('display', 'block'); |
2770 | |
2771 | function hide_spinner() { |
2772 | - Y.get('#bugfilters-portlet-spinner').setStyle('display', 'none'); |
2773 | + Y.one('#bugfilters-portlet-spinner').setStyle('display', 'none'); |
2774 | } |
2775 | |
2776 | function on_success(transactionid, response, arguments) { |
2777 | @@ -29,7 +29,7 @@ |
2778 | |
2779 | var config = {on: {success: on_success, |
2780 | failure: hide_spinner}}; |
2781 | - var url = Y.get('#bugtarget-bugfilters-link').getAttribute('href'); |
2782 | + var url = Y.one('#bugtarget-bugfilters-link').getAttribute('href'); |
2783 | var request = Y.io(url, config); |
2784 | }); |
2785 | }); |
2786 | |
2787 | === modified file 'lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt' |
2788 | --- lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt 2009-09-13 20:39:15 +0000 |
2789 | +++ lib/lp/bugs/templates/bugtarget-portlet-bugtags.pt 2009-11-18 13:45:26 +0000 |
2790 | @@ -11,15 +11,15 @@ |
2791 | <script type="text/javascript"> |
2792 | YUI().use('io-base', 'node', function(Y) { |
2793 | Y.on('domready', function() { |
2794 | - Y.get('#tags-portlet-spinner').setStyle('display', 'block'); |
2795 | + Y.one('#tags-portlet-spinner').setStyle('display', 'block'); |
2796 | |
2797 | function hide_spinner() { |
2798 | - Y.get('#tags-portlet-spinner').setStyle('display', 'none'); |
2799 | + Y.one('#tags-portlet-spinner').setStyle('display', 'none'); |
2800 | } |
2801 | |
2802 | function on_success(transactionid, response, arguments) { |
2803 | hide_spinner(); |
2804 | - var portlet = Y.get('#portlet-tags'); |
2805 | + var portlet = Y.one('#portlet-tags'); |
2806 | if (Y.Lang.trim(response.responseText).length == 0) { |
2807 | portlet.setStyle('display', 'none') |
2808 | } |
2809 | @@ -31,7 +31,7 @@ |
2810 | |
2811 | var config = {on: {success: on_success, |
2812 | failure: hide_spinner}}; |
2813 | - var url = Y.get('#tags-content-link').getAttribute('href').replace('bugs.', ''); |
2814 | + var url = Y.one('#tags-content-link').getAttribute('href').replace('bugs.', ''); |
2815 | Y.io(url, config); |
2816 | }); |
2817 | }); |
2818 | |
2819 | === modified file 'lib/lp/bugs/templates/bugtask-index.pt' |
2820 | --- lib/lp/bugs/templates/bugtask-index.pt 2009-10-28 06:08:11 +0000 |
2821 | +++ lib/lp/bugs/templates/bugtask-index.pt 2009-11-18 13:45:26 +0000 |
2822 | @@ -157,7 +157,7 @@ |
2823 | // non-JS form, we first disable the link. This is awful and |
2824 | // must be fixed as soon as YUI3 is fixed. |
2825 | if (LP.client.links['me'] !== undefined) { |
2826 | - Y.get('#edit-tags-trigger').on('click', function(e) { |
2827 | + Y.one('#edit-tags-trigger').on('click', function(e) { |
2828 | e.halt(); |
2829 | }); |
2830 | } |
2831 | |
2832 | === modified file 'lib/lp/code/templates/branch-import-details.pt' |
2833 | --- lib/lp/code/templates/branch-import-details.pt 2009-09-15 04:21:59 +0000 |
2834 | +++ lib/lp/code/templates/branch-import-details.pt 2009-11-18 13:45:26 +0000 |
2835 | @@ -33,7 +33,7 @@ |
2836 | </a> |
2837 | <script type="text/javascript"> |
2838 | YUI().use('event', 'node', function(Y) { |
2839 | - Y.on("domready", function () { Y.get('#tryagainlink').setStyle('display', 'inline') }); |
2840 | + Y.on("domready", function () { Y.one('#tryagainlink').setStyle('display', 'inline') }); |
2841 | }); |
2842 | </script> |
2843 | </form> |
2844 | |
2845 | === modified file 'lib/lp/code/templates/branch-listing.pt' |
2846 | --- lib/lp/code/templates/branch-listing.pt 2009-10-28 23:40:13 +0000 |
2847 | +++ lib/lp/code/templates/branch-listing.pt 2009-11-18 13:45:26 +0000 |
2848 | @@ -64,7 +64,7 @@ |
2849 | |
2850 | spark_div = branch_sparks[spark_div][0]; |
2851 | |
2852 | - if (Y.get('#' + spark_div) !== null) { |
2853 | + if (Y.one('#' + spark_div) !== null) { |
2854 | json_url = branch_sparks[0][1]; |
2855 | var container = spark_div; |
2856 | var uri = json_url; |
2857 | |
2858 | === modified file 'lib/lp/code/templates/branch-portlet-subscribers.pt' |
2859 | --- lib/lp/code/templates/branch-portlet-subscribers.pt 2009-09-15 03:34:45 +0000 |
2860 | +++ lib/lp/code/templates/branch-portlet-subscribers.pt 2009-11-18 13:45:26 +0000 |
2861 | @@ -44,7 +44,7 @@ |
2862 | YUI().use('io-base', 'node', 'code.branchsubscription', function(Y) { |
2863 | |
2864 | if(Y.UA.ie) { |
2865 | - Y.get('#subscriber-list').set('innerHTML', |
2866 | + Y.one('#subscriber-list').set('innerHTML', |
2867 | 'Could not load subscribers, javascript is disabled.'); |
2868 | return; |
2869 | } |
2870 | |
2871 | === modified file 'lib/lp/code/templates/branchmergeproposal-generic-listing.pt' |
2872 | --- lib/lp/code/templates/branchmergeproposal-generic-listing.pt 2009-09-16 04:29:55 +0000 |
2873 | +++ lib/lp/code/templates/branchmergeproposal-generic-listing.pt 2009-11-18 13:45:26 +0000 |
2874 | @@ -27,10 +27,10 @@ |
2875 | YUI().use('node', function(Y) { |
2876 | |
2877 | function submit_filter() { |
2878 | - Y.get('#filter_form').submit(); |
2879 | + Y.one('#filter_form').submit(); |
2880 | } |
2881 | Y.on('domready', function () { |
2882 | - var field = Y.get("[id=field.status]"); |
2883 | + var field = Y.one("[id=field.status]"); |
2884 | field.on('change', submit_filter); |
2885 | }); |
2886 | |
2887 | |
2888 | === modified file 'lib/lp/registry/templates/distributionsourcepackage-index.pt' |
2889 | --- lib/lp/registry/templates/distributionsourcepackage-index.pt 2009-11-07 04:37:23 +0000 |
2890 | +++ lib/lp/registry/templates/distributionsourcepackage-index.pt 2009-11-18 13:45:26 +0000 |
2891 | @@ -271,11 +271,11 @@ |
2892 | // XXX Michael Nelson 20090702 bug=340497 This slider |
2893 | // needs an integration test. |
2894 | // Collapse the body of the slider widget initially. |
2895 | - Y.get('#related-ppa-versions .widget-bd').addClass('lazr-closed'); |
2896 | + Y.one('#related-ppa-versions .widget-bd').addClass('lazr-closed'); |
2897 | |
2898 | // Ensure that the widget header uses the correct sprite icon |
2899 | // and gets the styling for javascript actions applied. |
2900 | - var widget_header = Y.get('#related-ppa-versions .widget-hd'); |
2901 | + var widget_header = Y.one('#related-ppa-versions .widget-hd'); |
2902 | widget_header.addClass('sprite'); |
2903 | widget_header.addClass('treeCollapsed'); |
2904 | widget_header.addClass('js-action'); |
2905 | |
2906 | === modified file 'lib/lp/registry/templates/object-timeline-graph.pt' |
2907 | --- lib/lp/registry/templates/object-timeline-graph.pt 2009-09-28 20:48:08 +0000 |
2908 | +++ lib/lp/registry/templates/object-timeline-graph.pt 2009-11-18 13:45:26 +0000 |
2909 | @@ -48,7 +48,7 @@ |
2910 | |
2911 | // Don't display graph if there are zero milestones or |
2912 | // releases. |
2913 | - var container = Y.get('#timeline-container'); |
2914 | + var container = Y.one('#timeline-container'); |
2915 | container.setStyle('display', 'block'); |
2916 | var config = { |
2917 | timeline: timeline, |
2918 | @@ -59,7 +59,7 @@ |
2919 | } |
2920 | var graph = new Y.registry.timeline.TimelineGraph(config); |
2921 | graph.render(); |
2922 | - Y.get('#spinner').setStyle('display', 'none'); |
2923 | + Y.one('#spinner').setStyle('display', 'none'); |
2924 | // Scroll to the most recent milestones or |
2925 | // releases on the development focus series. |
2926 | graph.scroll_to_last_development_focus_landmark(); |
2927 | |
2928 | === modified file 'lib/lp/registry/templates/person-macros.pt' |
2929 | --- lib/lp/registry/templates/person-macros.pt 2009-09-18 19:31:04 +0000 |
2930 | +++ lib/lp/registry/templates/person-macros.pt 2009-11-18 13:45:26 +0000 |
2931 | @@ -200,7 +200,7 @@ |
2932 | // XXX: Brad Crittenden 2009-01-30 |
2933 | // bug=http://yuilibrary.com/projects/yui3/ticket/2423101 |
2934 | // Dotted CSS selectors not parsed correctly. Therefore not |
2935 | - // using Y.get(). |
2936 | + // using Y.one(). |
2937 | var name = document.getElementById('field.name'); |
2938 | name.value = prefix + name.value.replace(/^$private_prefix/, ''); |
2939 | |
2940 | |
2941 | === modified file 'lib/lp/registry/templates/product-new.pt' |
2942 | --- lib/lp/registry/templates/product-new.pt 2009-10-01 11:53:27 +0000 |
2943 | +++ lib/lp/registry/templates/product-new.pt 2009-11-18 13:45:26 +0000 |
2944 | @@ -34,11 +34,11 @@ |
2945 | * XXX BarryWarsaw 12-May-2009 |
2946 | * http://yuilibrary.com/projects/yui3/ticket/2423101 |
2947 | * Note that we have to use the more verbose way of getting field.name |
2948 | - * because Y.get() doesn't like the dots in the Zope field names. |
2949 | + * because Y.one() doesn't like the dots in the Zope field names. |
2950 | */ |
2951 | - var url_field = Y.get(Y.DOM.byId('field.name')); |
2952 | + var url_field = Y.one(Y.DOM.byId('field.name')); |
2953 | if (url_field) { |
2954 | - var name_field = Y.get(Y.DOM.byId('field.displayname')); |
2955 | + var name_field = Y.one(Y.DOM.byId('field.displayname')); |
2956 | function autofill(e) { |
2957 | var name_value = name_field.get('value'); |
2958 | if (name_value == '') { |
2959 | @@ -110,17 +110,17 @@ |
2960 | } |
2961 | |
2962 | /* Handle the reveals when there are search results. */ |
2963 | - var details_buttons = Y.get('#registration-details-buttons'); |
2964 | - var form_actions = Y.get('#launchpad-form-actions'); |
2965 | - var form_widgets = Y.get('#launchpad-form-widgets'); |
2966 | - var search_results = Y.get('#search-results'); |
2967 | - var step_title = Y.get('#step-title'); |
2968 | - var title = Y.get('#registration-details-title'); |
2969 | + var details_buttons = Y.one('#registration-details-buttons'); |
2970 | + var form_actions = Y.one('#launchpad-form-actions'); |
2971 | + var form_widgets = Y.one('#launchpad-form-widgets'); |
2972 | + var search_results = Y.one('#search-results'); |
2973 | + var step_title = Y.one('#step-title'); |
2974 | + var title = Y.one('#registration-details-title'); |
2975 | |
2976 | /* This is the magic hidden widget used by the MultiStepView. */ |
2977 | - var marker = Y.get(Y.DOM.byId('field.__visited_steps__')); |
2978 | + var marker = Y.one(Y.DOM.byId('field.__visited_steps__')); |
2979 | |
2980 | - var separator = Y.get('#registration-separator'); |
2981 | + var separator = Y.one('#registration-separator'); |
2982 | function show_separator(flag) { |
2983 | if (!separator) { |
2984 | /* The separator is not on the page, because there were no |
2985 | @@ -141,14 +141,14 @@ |
2986 | * to leave the search results there. |
2987 | */ |
2988 | function complete_registration(e) { |
2989 | - var expander = Y.get('#search-results-expander'); |
2990 | + var expander = Y.one('#search-results-expander'); |
2991 | |
2992 | /* Slide in the search results and hide them under a link. */ |
2993 | expander.removeClass('unseen'); |
2994 | expander.on('click', function(e) { |
2995 | e.preventDefault(); |
2996 | |
2997 | - var arrow = Y.get('#search-results-arrow'); |
2998 | + var arrow = Y.one('#search-results-arrow'); |
2999 | if (arrow.getAttribute('src') == '/@@/treeCollapsed') { |
3000 | /* The search results are currently hidden. Slide them |
3001 | * out and turn the arrow to point downward. |
3002 | |
3003 | === modified file 'lib/lp/registry/templates/productrelease-add-from-series.pt' |
3004 | --- lib/lp/registry/templates/productrelease-add-from-series.pt 2009-09-03 22:35:47 +0000 |
3005 | +++ lib/lp/registry/templates/productrelease-add-from-series.pt 2009-11-18 13:45:26 +0000 |
3006 | @@ -29,12 +29,12 @@ |
3007 | // to be escaped. |
3008 | |
3009 | var get_by_id = function(id) { |
3010 | - return Y.get(Y.DOM.byId(id)); |
3011 | + return Y.one(Y.DOM.byId(id)); |
3012 | }; |
3013 | |
3014 | var add_milestone_to_menu = function(parameters) { |
3015 | var select_menu = get_by_id('field.milestone_for_release'); |
3016 | - var new_milestone_option = Y.get( |
3017 | + var new_milestone_option = Y.one( |
3018 | new Option(parameters.name + '*', parameters.name)); |
3019 | select_menu.appendChild(new_milestone_option); |
3020 | var children = select_menu.get('children'); |
3021 | |
3022 | === modified file 'lib/lp/registry/templates/teammembership-index.pt' |
3023 | --- lib/lp/registry/templates/teammembership-index.pt 2009-10-08 00:26:50 +0000 |
3024 | +++ lib/lp/registry/templates/teammembership-index.pt 2009-11-18 13:45:26 +0000 |
3025 | @@ -24,9 +24,9 @@ |
3026 | // Ensure that when the picker is used the radio button switches |
3027 | // from 'Never' to 'On' and the expiry field is enabled. |
3028 | Y.on("available", function(e) { |
3029 | - var choose_link = Y.get("#expiration-widget a.js-action"); |
3030 | - var radio_on = Y.get("#date"); |
3031 | - var expiration_date = Y.get( |
3032 | + var choose_link = Y.one("#expiration-widget a.js-action"); |
3033 | + var radio_on = Y.one("#date"); |
3034 | + var expiration_date = Y.one( |
3035 | document.getElementById('membership.expirationdate')); |
3036 | choose_link.on('click', function(e) { |
3037 | expiration_date.set('disabled', false); |
3038 | |
3039 | === modified file 'lib/lp/registry/templates/timeline-macros.pt' |
3040 | --- lib/lp/registry/templates/timeline-macros.pt 2009-10-02 17:20:49 +0000 |
3041 | +++ lib/lp/registry/templates/timeline-macros.pt 2009-11-18 13:45:26 +0000 |
3042 | @@ -39,9 +39,9 @@ |
3043 | if (Y.UA.ie) { |
3044 | return; |
3045 | } |
3046 | - var loading_el = Y.get('#timeline-loading'); |
3047 | + var loading_el = Y.one('#timeline-loading'); |
3048 | loading_el.setStyle('display', 'block'); |
3049 | - var iframe = Y.get('#timeline-iframe'); |
3050 | + var iframe = Y.one('#timeline-iframe'); |
3051 | iframe.set('src', timeline_url); |
3052 | Y.on('load', function(e) { |
3053 | loading_el.setStyle('display', 'none'); |
3054 | |
3055 | === modified file 'lib/lp/soyuz/templates/archive-edit-dependencies.pt' |
3056 | --- lib/lp/soyuz/templates/archive-edit-dependencies.pt 2009-10-16 13:20:48 +0000 |
3057 | +++ lib/lp/soyuz/templates/archive-edit-dependencies.pt 2009-11-18 13:45:26 +0000 |
3058 | @@ -69,7 +69,7 @@ |
3059 | // contained by the label. |
3060 | function highlight_checked (nodes) { |
3061 | nodes.each(function(input) { |
3062 | - var label = Y.get(input.get("parentNode")); |
3063 | + var label = Y.one(input.get("parentNode")); |
3064 | if (input.get("checked")) { |
3065 | label.setStyle("fontWeight", "bold"); |
3066 | } |
3067 | @@ -79,45 +79,38 @@ |
3068 | }); |
3069 | }; |
3070 | |
3071 | - var main_area = Y.get("#mainarea"); |
3072 | + var main_area = Y.one("#mainarea"); |
3073 | |
3074 | // Highlight the selected radio button input on page load. |
3075 | - var inputs = main_area.queryAll("input.highlight-selected"); |
3076 | + var inputs = main_area.all("input.highlight-selected"); |
3077 | highlight_checked(inputs); |
3078 | |
3079 | // Install signal handlers for all radio-button inputs to |
3080 | // recalculate with options should be highlighted when one of |
3081 | // them is clicked. |
3082 | - inputs.each(function(input) { |
3083 | - input.on("click", function(e) { |
3084 | - var main_area = Y.get("#mainarea"); |
3085 | - var inputs = main_area.queryAll("input.highlight-selected"); |
3086 | - highlight_checked(inputs); |
3087 | - }); |
3088 | - }); |
3089 | + inputs.on("click", function(e) { |
3090 | + highlight_checked(inputs); |
3091 | + }, this); |
3092 | |
3093 | // Install handlers to decorate selected check-box inputs when |
3094 | // they get clicked. Selected options text (next sibling) will |
3095 | // be decorated with 'line-through' style and rendered in |
3096 | // 'red'. Options not selected (or unselected) text will be |
3097 | // rendered in 'blue' and without any decoration. |
3098 | - var inputs = main_area.queryAll("input.line-through-when-checked"); |
3099 | - if (inputs) { |
3100 | - inputs.each(function(input) { |
3101 | - input.on("click", function(e) { |
3102 | - var input = e.currentTarget; |
3103 | - var link = input.next(); |
3104 | - if (input.get("checked")) { |
3105 | - link.setStyle("color", "red"); |
3106 | - link.setStyle("textDecoration", "line-through"); |
3107 | - } |
3108 | - else { |
3109 | - link.setStyle("color", "blue"); |
3110 | - link.setStyle("textDecoration", "none"); |
3111 | - } |
3112 | - }); |
3113 | + main_area.all( |
3114 | + "input.line-through-when-checked").on('click', function(e) { |
3115 | + var input = e.currentTarget; |
3116 | + var link = input.next(); |
3117 | + if (input.get("checked")) { |
3118 | + link.setStyle("color", "red"); |
3119 | + link.setStyle("textDecoration", "line-through"); |
3120 | + } |
3121 | + else { |
3122 | + link.setStyle("color", "blue"); |
3123 | + link.setStyle("textDecoration", "none"); |
3124 | + } |
3125 | }); |
3126 | - }; |
3127 | + }); |
3128 | }); |
3129 | </script> |
3130 | |
3131 | |
3132 | === modified file 'lib/lp/soyuz/templates/archive-index.pt' |
3133 | --- lib/lp/soyuz/templates/archive-index.pt 2009-09-22 04:06:47 +0000 |
3134 | +++ lib/lp/soyuz/templates/archive-index.pt 2009-11-18 13:45:26 +0000 |
3135 | @@ -148,11 +148,11 @@ |
3136 | }).use('node', 'event', 'lazr.effects', function(Y) { |
3137 | |
3138 | // Hide the widget body contents. |
3139 | - Y.get('#ppa-install .widget-body').addClass('lazr-closed'); |
3140 | + Y.one('#ppa-install .widget-body').addClass('lazr-closed'); |
3141 | |
3142 | // Ensure that the widget header uses the correct sprite icon |
3143 | // and gets the styling for javascript actions applied. |
3144 | - var widget_header = Y.get('#ppa-install .widget-header'); |
3145 | + var widget_header = Y.one('#ppa-install .widget-header'); |
3146 | widget_header.addClass('sprite'); |
3147 | widget_header.addClass('treeCollapsed'); |
3148 | widget_header.addClass('js-action'); |
3149 | |
3150 | === modified file 'lib/lp/soyuz/templates/archive-macros.pt' |
3151 | --- lib/lp/soyuz/templates/archive-macros.pt 2009-10-16 11:47:55 +0000 |
3152 | +++ lib/lp/soyuz/templates/archive-macros.pt 2009-11-18 13:45:26 +0000 |
3153 | @@ -88,14 +88,14 @@ |
3154 | * the expander itself. |
3155 | */ |
3156 | function toggleExpandableRow(expander) { |
3157 | - var row = Y.get('#' + expander.get('id').replace('-expander', '')); |
3158 | - var icon = expander.query('img'); |
3159 | + var row = Y.one('#' + expander.get('id').replace('-expander', '')); |
3160 | + var icon = expander.one('img'); |
3161 | |
3162 | var row_display = row.getStyle('display'); |
3163 | if (row_display == 'none') { |
3164 | row.setStyle('display', 'table-row'); |
3165 | icon.set('src', '/@@/treeExpanded'); |
3166 | - var container = Y.get('#' + row.get('id') + '-container'); |
3167 | + var container = Y.one('#' + row.get('id') + '-container'); |
3168 | if (trim(container.get('innerHTML')) == ''){ |
3169 | startUpdate(container); |
3170 | } |
3171 | |
3172 | === modified file 'lib/lp/soyuz/templates/archive-packages.pt' |
3173 | --- lib/lp/soyuz/templates/archive-packages.pt 2009-09-18 21:00:18 +0000 |
3174 | +++ lib/lp/soyuz/templates/archive-packages.pt 2009-11-18 13:45:26 +0000 |
3175 | @@ -65,7 +65,7 @@ |
3176 | in_progress_message = Y.soyuz.makeInProgressNode( |
3177 | 'Fetching repository size ...') |
3178 | |
3179 | - var container = Y.get('#package-counters'); |
3180 | + var container = Y.one('#package-counters'); |
3181 | container.set('innerHTML', ''); |
3182 | container.appendChild(in_progress_message); |
3183 | |
3184 | |
3185 | === modified file 'lib/lp/soyuz/windmill/tests/test_archivesubscribersindex.py' |
3186 | --- lib/lp/soyuz/windmill/tests/test_archivesubscribersindex.py 2009-09-29 12:09:39 +0000 |
3187 | +++ lib/lp/soyuz/windmill/tests/test_archivesubscribersindex.py 2009-11-18 13:45:26 +0000 |
3188 | @@ -15,13 +15,11 @@ |
3189 | |
3190 | from canonical.launchpad.ftests import login, logout |
3191 | from canonical.launchpad.windmill.testing.lpuser import LaunchpadUser |
3192 | +from canonical.launchpad.windmill.testing import constants |
3193 | from lp.registry.interfaces.distribution import IDistributionSet |
3194 | from lp.soyuz.windmill.testing import SoyuzWindmillLayer |
3195 | from lp.testing import TestCaseWithFactory |
3196 | |
3197 | -WAIT_PAGELOAD = u'30000' |
3198 | -WAIT_ELEMENT_COMPLETE = u'30000' |
3199 | -WAIT_CHECK_CHANGE = u'1000' |
3200 | ADD_ACCESS_LINK = u'//a[@class="js-action sprite add"]' |
3201 | CHOOSE_SUBSCRIBER_LINK = u'//a[@id="show-widget-field-subscriber"]' |
3202 | SUBSCRIBER_SEARCH_FIELD = ( |
3203 | @@ -30,6 +28,7 @@ |
3204 | FIRST_SUBSCRIBER_RESULT = ( |
3205 | u'//div[@id="yui-pretty-overlay-modal"]' |
3206 | '//span[@class="yui-picker-result-title"]') |
3207 | +MESSAGE_WINDOW = u'//div[@class="informational message"]' |
3208 | |
3209 | |
3210 | class TestArchiveSubscribersIndex(TestCaseWithFactory): |
3211 | @@ -59,15 +58,16 @@ |
3212 | def test_add_subscriber(self): |
3213 | """Test adding a private PPA subscriber..""" |
3214 | client = WindmillTestClient('Adding private PPA subscribers.') |
3215 | - |
3216 | + |
3217 | self.lpuser.ensure_login(client) |
3218 | |
3219 | client.open(url='http://launchpad.dev:8085/~joe-bloggs/' |
3220 | '+archive/myppa/+subscriptions') |
3221 | - client.waits.forPageLoad(timeout=WAIT_PAGELOAD) |
3222 | + client.waits.forPageLoad(timeout=constants.PAGE_LOAD) |
3223 | |
3224 | # Click on the JS add access action. |
3225 | - client.waits.forElement(xpath=ADD_ACCESS_LINK) |
3226 | + client.waits.forElement( |
3227 | + xpath=ADD_ACCESS_LINK, timeout=constants.FOR_ELEMENT) |
3228 | client.click(xpath=ADD_ACCESS_LINK) |
3229 | |
3230 | # Open the picker, search for 'launchpad' and choose the first |
3231 | @@ -76,15 +76,18 @@ |
3232 | client.type(xpath=SUBSCRIBER_SEARCH_FIELD, text='launchpad') |
3233 | client.click(xpath=SUBSCRIBER_SEARCH_BUTTON) |
3234 | |
3235 | - client.waits.forElement(xpath=FIRST_SUBSCRIBER_RESULT) |
3236 | + client.waits.forElement( |
3237 | + xpath=FIRST_SUBSCRIBER_RESULT, timeout=constants.FOR_ELEMENT) |
3238 | client.click(xpath=FIRST_SUBSCRIBER_RESULT) |
3239 | |
3240 | # Add the new subscriber. |
3241 | client.click(id='field.actions.add') |
3242 | - client.waits.forPageLoad(timeout=WAIT_PAGELOAD) |
3243 | + client.waits.forPageLoad(timeout=constants.PAGE_LOAD) |
3244 | |
3245 | # And verify that the correct informational message is displayed. |
3246 | # It would be nice if we could use ... here. |
3247 | + client.waits.forElement( |
3248 | + xpath=MESSAGE_WINDOW, timeout=constants.FOR_ELEMENT) |
3249 | client.asserts.assertText( |
3250 | xpath=u'//div[@class="informational message"]', |
3251 | validator='You have granted access for Launchpad Developers ' |
3252 | |
3253 | === modified file 'lib/lp/translations/templates/object-templates.pt' |
3254 | --- lib/lp/translations/templates/object-templates.pt 2009-10-22 11:49:30 +0000 |
3255 | +++ lib/lp/translations/templates/object-templates.pt 2009-11-18 13:45:26 +0000 |
3256 | @@ -35,19 +35,17 @@ |
3257 | } |
3258 | </style> |
3259 | <script language="JavaScript" type="text/javascript"> |
3260 | - YUI().use('node', function(Y) { |
3261 | + YUI().use('node-base', 'event-delegate', function(Y) { |
3262 | Y.on('domready', function(e) { |
3263 | - Y.all('.template_links').addClass('inactive_links'); |
3264 | - var template_rows = Y.all('.template_row'); |
3265 | - template_rows.each(function(row) { |
3266 | - var template_links = row.query('.template_links'); |
3267 | - row.on('mouseover', function(e) { |
3268 | - template_links.removeClass('inactive_links'); |
3269 | - }); |
3270 | - row.on('mouseout', function(e) { |
3271 | - template_links.addClass('inactive_links'); |
3272 | - }); |
3273 | - }); |
3274 | + Y.all('#template_table .template_links').addClass('inactive_links'); |
3275 | + |
3276 | + Y.delegate('mouseover', function(e) { |
3277 | + this.removeClass('inactive_links'); |
3278 | + }, '#template_table tbody', '.template_links'); |
3279 | + |
3280 | + Y.delegate('mouseout', function(e) { |
3281 | + this.addClass('inactive_links'); |
3282 | + }, '#template_table tbody', '.template_links'); |
3283 | }); |
3284 | }); |
3285 | </script> |
3286 | |
3287 | === modified file 'lib/lp/translations/templates/pofile-export.pt' |
3288 | --- lib/lp/translations/templates/pofile-export.pt 2009-11-06 01:16:21 +0000 |
3289 | +++ lib/lp/translations/templates/pofile-export.pt 2009-11-18 13:45:26 +0000 |
3290 | @@ -16,9 +16,9 @@ |
3291 | YUI().use('node', 'event', function(Y){ |
3292 | Y.on('domready', function(){ |
3293 | // The pochanged option is only available for the PO format. |
3294 | - var formatlist = Y.get('#div_format select'); |
3295 | - var checkbox = Y.get('#div_pochanged input'); |
3296 | - var changedtext = Y.get('#div_pochanged span'); |
3297 | + var formatlist = Y.one('#div_format select'); |
3298 | + var checkbox = Y.one('#div_pochanged input'); |
3299 | + var changedtext = Y.one('#div_pochanged span'); |
3300 | function toggle_pochanged() { |
3301 | if (formatlist.get('value') == 'PO') { |
3302 | changedtext.removeClass('disabledpochanged'); |
3303 | |
3304 | === modified file 'lib/lp/translations/templates/pofile-translate.pt' |
3305 | --- lib/lp/translations/templates/pofile-translate.pt 2009-09-14 16:19:15 +0000 |
3306 | +++ lib/lp/translations/templates/pofile-translate.pt 2009-11-18 13:45:26 +0000 |
3307 | @@ -38,8 +38,8 @@ |
3308 | } |
3309 | |
3310 | var updateNotificationBox = function(e) { |
3311 | - var notice = Y.get('.important-notice-container'); |
3312 | - var balloon = notice.query('.important-notice-balloon'); |
3313 | + var notice = Y.one('.important-notice-container'); |
3314 | + var balloon = notice.one('.important-notice-balloon'); |
3315 | var dismiss_notice_cookie = ('translation-docs-for-' + |
3316 | documentation_cookie); |
3317 | |
3318 | @@ -50,7 +50,7 @@ |
3319 | notice.setStyle('display', 'none'); |
3320 | } |
3321 | |
3322 | - var cancel_button = notice.query( |
3323 | + var cancel_button = notice.one( |
3324 | '.important-notice-cancel-button'); |
3325 | // Cancel button starts out hidden. If user has JavaScript, |
3326 | // then we want to show it. |
3327 | |
3328 | === modified file 'lib/lp/translations/templates/translationimportqueueentry-index.pt' |
3329 | --- lib/lp/translations/templates/translationimportqueueentry-index.pt 2009-09-01 12:09:27 +0000 |
3330 | +++ lib/lp/translations/templates/translationimportqueueentry-index.pt 2009-11-18 13:45:26 +0000 |
3331 | @@ -29,7 +29,7 @@ |
3332 | function getElemById(elem_id) { |
3333 | // XXX 'elem_id' is a Zope form field, and triggers |
3334 | // YUI bug #2423101. We'll work around it. |
3335 | - return Y.get(Y.DOM.byId(elem_id)); |
3336 | + return Y.one(Y.DOM.byId(elem_id)); |
3337 | } |
3338 | |
3339 | function getEnclosingTR(fieldname) { |
3340 | |
3341 | === modified file 'setup.py' |
3342 | --- setup.py 2009-10-31 12:07:16 +0000 |
3343 | +++ setup.py 2009-11-18 13:45:26 +0000 |
3344 | @@ -27,6 +27,7 @@ |
3345 | 'bzr', |
3346 | 'chameleon.core', |
3347 | 'chameleon.zpt', |
3348 | + 'cssutils', |
3349 | 'feedvalidator', |
3350 | 'funkload', |
3351 | 'launchpadlib', |
3352 | @@ -37,6 +38,7 @@ |
3353 | 'lazr.lifecycle', |
3354 | 'lazr.restful', |
3355 | 'lazr.smtptest', |
3356 | + 'lazr.testing', |
3357 | 'lazr.uri', |
3358 | 'lazr-js', |
3359 | 'mechanize', |
3360 | |
3361 | === modified file 'versions.cfg' |
3362 | --- versions.cfg 2009-11-17 20:34:27 +0000 |
3363 | +++ versions.cfg 2009-11-18 13:45:26 +0000 |
3364 | @@ -11,6 +11,7 @@ |
3365 | chameleon.core = 1.0b35 |
3366 | chameleon.zpt = 1.0b17 |
3367 | ClientForm = 0.2.10 |
3368 | +cssutils = 0.9.6 |
3369 | # Required by Windmill to run on 2.4 |
3370 | ctypes = 1.0.2 |
3371 | docutils = 0.5 |
3372 | @@ -32,8 +33,9 @@ |
3373 | lazr.restful = 0.9.17 |
3374 | lazr.restfulclient = 0.9.10 |
3375 | lazr.smtptest = 1.1 |
3376 | +lazr.testing = 0.1.1 |
3377 | lazr.uri = 1.0.2 |
3378 | -lazr-js = 0.9.1 |
3379 | +lazr-js = 0.9dev-r153 |
3380 | martian = 0.11 |
3381 | mechanize = 0.1.11 |
3382 | mocker = 0.10.1 |
Hi,
This branch upgrades Launchpad's JavaScript from YUI 3 PR2 to YUI 3.0.0 final.
The branch has a few windmill errors, so it should not be merged quite yet. However, the diff is large, so it is probably in everyone's best interest to review it before it grows more.
There are some changes to the underlying build system that need to be reverted before submission, such as the changes to setup.py, buildout.cfg, etc.