Merge lp:~rockstar/launchpad/code-js-reorg into lp:launchpad

Proposed by Paul Hummer
Status: Merged
Approved by: Graham Binns
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/code-js-reorg
Merge into: lp:launchpad
Diff against target: 343 lines (+49/-47)
11 files modified
lib/canonical/launchpad/javascript/code/branchlinks.js (+4/-4)
lib/canonical/launchpad/javascript/code/branchmergeproposal.js (+5/-5)
lib/canonical/launchpad/javascript/code/branchstatus.js (+4/-4)
lib/canonical/launchpad/javascript/code/codereview.js (+9/-7)
lib/canonical/launchpad/javascript/code/popupdiff.js (+6/-6)
lib/canonical/launchpad/javascript/code/subscription.js (+4/-4)
lib/canonical/launchpad/windmill/jstests/launchpad_ajax.js (+2/-2)
lib/lp/bugs/templates/bugtask-index.pt (+2/-2)
lib/lp/code/templates/branch-index.pt (+6/-6)
lib/lp/code/templates/branch-related-bugs-specs.pt (+2/-2)
lib/lp/code/templates/branchmergeproposal-index.pt (+5/-5)
To merge this branch: bzr merge lp:~rockstar/launchpad/code-js-reorg
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve
Review via email: mp+20170@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Paul Hummer (rockstar) wrote :

Hi there-

  This branch just fixes bug 513270. Basically, the code Javascript doesn't
conform to our new(er) Javascript standards. This branch is actually a split
up version of what I wanted to do with the javascript, but the revisions past
this will conflict with thumper's work that I reviewed yesterday, and I don't
want to make the major changes (from the latter revisions) so close to release
time.

Cheers,
Paul

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/canonical/launchpad/javascript/code/branchlinks.js'
2--- lib/canonical/launchpad/javascript/code/branchlinks.js 2009-11-24 09:30:01 +0000
3+++ lib/canonical/launchpad/javascript/code/branchlinks.js 2010-03-11 19:22:24 +0000
4@@ -7,9 +7,9 @@
5 * @requires base, lazr.anim, lazr.formoverlay
6 */
7
8-YUI.add('code.branchlinks', function(Y) {
9+YUI.add('lp.code.branchlinks', function(Y) {
10
11-Y.branchlinks = Y.namespace('code.branchlinks');
12+var namespace = Y.namespace('lp.code.branchlinks');
13
14 var lp_client; // The LP client
15
16@@ -20,7 +20,7 @@
17 /*
18 * Connect the links to the javascript events.
19 */
20-Y.branchlinks.connect_branchlinks = function() {
21+namespace.connect_branchlinks = function() {
22
23 error_handler = new LP.client.ErrorHandler();
24 error_handler.clearProgressUI = function() {
25@@ -163,7 +163,7 @@
26
27 // Check to see if that was the only bug linked.
28 var buglinks = Y.all(".bug-branch-summary");
29- if (buglinks.size() == 0) {
30+ if (!buglinks.size()) {
31 Y.one('#linkbug').set('innerHTML',
32 'Link to a bug report');
33 }
34
35=== modified file 'lib/canonical/launchpad/javascript/code/branchmergeproposal.js'
36--- lib/canonical/launchpad/javascript/code/branchmergeproposal.js 2010-02-25 00:39:57 +0000
37+++ lib/canonical/launchpad/javascript/code/branchmergeproposal.js 2010-03-11 19:22:24 +0000
38@@ -1,19 +1,19 @@
39 /** Copyright (c) 2009, Canonical Ltd. All rights reserved.
40 *
41- * Code for handling the update of the branch status.
42+ * Code for handling the update of the branch merge proposals.
43 *
44- * @module branchstatus
45+ * @module lp.code.branchmergeproposal
46 * @requires node, lazr.choiceedit, lp.client.plugins
47 */
48
49-YUI.add('code.branchmergeproposal', function(Y) {
50+YUI.add('lp.code.branchmergeproposal', function(Y) {
51
52-Y.code.branchmergeproposal = Y.namespace('code.branchmergeproposal');
53+var namespace = Y.namespace('lp.code.branchmergeproposal');
54
55 /*
56 * Connect the branch status to the javascript events.
57 */
58-Y.code.branchmergeproposal.connect_status = function(conf) {
59+namespace.connect_status = function(conf) {
60
61 var status_content = Y.get('#branchmergeproposal-status-value');
62
63
64=== modified file 'lib/canonical/launchpad/javascript/code/branchstatus.js'
65--- lib/canonical/launchpad/javascript/code/branchstatus.js 2009-11-24 09:30:01 +0000
66+++ lib/canonical/launchpad/javascript/code/branchstatus.js 2010-03-11 19:22:24 +0000
67@@ -3,18 +3,18 @@
68 *
69 * Code for handling the update of the branch status.
70 *
71- * @module branchstatus
72+ * @module lp.code.branchstatus
73 * @requires node, lazr.choiceedit, lp.client.plugins
74 */
75
76-YUI.add('code.branchstatus', function(Y) {
77+YUI.add('lp.code.branchstatus', function(Y) {
78
79-Y.branchstatus = Y.namespace('code.branchstatus');
80+var namespace = Y.namespace('lp.code.branchstatus');
81
82 /*
83 * Connect the branch status to the javascript events.
84 */
85-Y.branchstatus.connect_status = function(conf) {
86+namespace.connect_status = function(conf) {
87
88 var status_content = Y.one('#branch-details-status-value');
89
90
91=== modified file 'lib/canonical/launchpad/javascript/code/codereview.js'
92--- lib/canonical/launchpad/javascript/code/codereview.js 2010-02-23 09:31:13 +0000
93+++ lib/canonical/launchpad/javascript/code/codereview.js 2010-03-11 19:22:24 +0000
94@@ -3,13 +3,13 @@
95 *
96 * Library for code review javascript.
97 *
98- * @module CodeReview
99+ * @module lp.code.codereview
100 * @requires base, lazr.anim, lazr.formoverlay
101 */
102
103-YUI.add('code.codereview', function(Y) {
104+YUI.add('lp.code.codereview', function(Y) {
105
106-Y.codereview = Y.namespace('code.codereview');
107+var namespace = Y.namespace('lp.code.codereview');
108
109 var reviewer_picker; // The "Request a review" overlay
110 var lp_client;
111@@ -23,7 +23,7 @@
112 /*
113 * Connect all the links to their given actions.
114 */
115-Y.codereview.connect_links = function() {
116+namespace.connect_links = function() {
117
118 var link = Y.one('#request-review');
119 if (Y.Lang.isValue(link)) {
120@@ -51,7 +51,9 @@
121
122 function link_scroller(link_selector, node_selector, on_end) {
123 var link = Y.one(link_selector);
124- if (!Y.Lang.isValue(link)) return;
125+ if (!Y.Lang.isValue(link)) {
126+ return;
127+ }
128
129 link.addClass('js-action');
130 link.on('click', function(e) {
131@@ -229,7 +231,7 @@
132 var target = Y.one('#votes-target');
133 target.set('innerHTML', response.responseText);
134
135- Y.codereview.connect_links();
136+ namespace.connect_links();
137 var new_reviewer = Y.one('#review-' + username);
138 var anim = Y.lazr.anim.green_flash({node: new_reviewer});
139 anim.run();
140@@ -276,6 +278,6 @@
141 }
142 });
143
144-Y.codereview.NumberToggle = NumberToggle;
145+namespace.NumberToggle = NumberToggle;
146
147 }, "0.1", {"requires": ["base", "widget", "lazr.anim", "lazr.formoverlay", "lp.picker"]});
148
149=== modified file 'lib/canonical/launchpad/javascript/code/popupdiff.js'
150--- lib/canonical/launchpad/javascript/code/popupdiff.js 2010-02-19 17:04:52 +0000
151+++ lib/canonical/launchpad/javascript/code/popupdiff.js 2010-03-11 19:22:24 +0000
152@@ -3,11 +3,14 @@
153 *
154 * Code for handling the popup diffs in the pretty overlays.
155 *
156- * @module popupdiff
157+ * @module lp.code.branchmergeproposal.popupdiff
158 * @requires node
159 */
160
161-YUI.add('code.branchmergeproposal.popupdiff', function(Y) {
162+YUI.add('lp.code.branchmergeproposal.popupdiff', function(Y) {
163+
164+// Grab the namespace in order to be able to expose the connect method.
165+var namespace = Y.namespace('lp.code.branchmergeproposal.popupdiff');
166
167 // The launchpad js client used.
168 var lp_client;
169@@ -90,9 +93,6 @@
170 }
171
172
173-// Grab the namespace in order to be able to expose the connect method.
174-var popupdiff = Y.namespace('code.branchmergeproposal.popupdiff');
175-
176 /*
177 * Link up the onclick handler for the a.diff-link in the node to the function
178 * that will popup the diff in the pretty overlay.
179@@ -113,7 +113,7 @@
180 /*
181 * Connect the diff links to their pretty overlay function.
182 */
183-popupdiff.connect_diff_links = function() {
184+namespace.connect_diff_links = function() {
185 // IE doesn't like pretty overlays.
186 if (Y.UA.ie) {
187 return;
188
189=== modified file 'lib/canonical/launchpad/javascript/code/subscription.js'
190--- lib/canonical/launchpad/javascript/code/subscription.js 2010-01-12 23:44:24 +0000
191+++ lib/canonical/launchpad/javascript/code/subscription.js 2010-03-11 19:22:24 +0000
192@@ -15,7 +15,7 @@
193 along with this program. If not, see <http://www.gnu.org/licenses/>.
194 */
195
196-YUI.add('code.branch.subscription', function(Y) {
197+YUI.add('lp.code.branch.subscription', function(Y) {
198
199 /*
200 * Tools for working with branch subscriptions.
201@@ -24,7 +24,7 @@
202 * @namespace lp.code.branch.subscription
203 */
204
205-var namespace = Y.namespace('code.branch.subscription');
206+var namespace = Y.namespace('lp.code.branch.subscription');
207
208 var display_name, // The logged in user's displayname.
209 user_name, // The logged in user's username.
210@@ -207,7 +207,7 @@
211 Y.on(
212 'branch:subscriber-list-stale',
213 this._updateSubscribersList);
214- },
215+ }
216 });
217 namespace.SubscriptionWidget = SubscriptionWidget;
218
219@@ -215,5 +215,5 @@
220 'event',
221 'io',
222 'lazr.formoverlay',
223- 'node',
224+ 'node'
225 ]});
226
227=== modified file 'lib/canonical/launchpad/windmill/jstests/launchpad_ajax.js'
228--- lib/canonical/launchpad/windmill/jstests/launchpad_ajax.js 2010-02-16 16:29:36 +0000
229+++ lib/canonical/launchpad/windmill/jstests/launchpad_ajax.js 2010-03-11 19:22:24 +0000
230@@ -344,7 +344,7 @@
231
232 // Now make sure patch() on a field resource works when we
233 // request a JSON representation in return.
234- var field_uri = LP.client.get_field_uri('~salgado', 'display_name');
235+ field_uri = LP.client.get_field_uri('~salgado', 'display_name');
236 client.patch(field_uri, 'Guilherme Salgado',
237 {on: test.create_yui_sync_on()});
238 },
239@@ -354,7 +354,7 @@
240 jum.assertEquals('success', test.result.callback);
241 var salgado_name_html = test.result.args[0];
242 jum.assertEquals(salgado_name_html, "Guilherme Salgado");
243- },
244+ }
245 ]);
246
247 //Test that modifying an entry and then calling lp_save() saves the
248
249=== modified file 'lib/lp/bugs/templates/bugtask-index.pt'
250--- lib/lp/bugs/templates/bugtask-index.pt 2010-01-22 03:16:44 +0000
251+++ lib/lp/bugs/templates/bugtask-index.pt 2010-03-11 19:22:24 +0000
252@@ -38,10 +38,10 @@
253 </tal:devmode>
254 <script type="text/javascript">
255 LPS.use('base', 'node', 'oop', 'event', 'bugs.bugtask_index',
256- 'code.branchmergeproposal.popupdiff', function(Y) {
257+ 'lp.code.branchmergeproposal.popupdiff', function(Y) {
258 Y.bugs.setup_bugtask_index();
259 Y.on('load', function(e) {
260- Y.code.branchmergeproposal.popupdiff.connect_diff_links();
261+ Y.lp.code.branchmergeproposal.popupdiff.connect_diff_links();
262 }, window);
263 });
264 </script>
265
266=== modified file 'lib/lp/code/templates/branch-index.pt'
267--- lib/lp/code/templates/branch-index.pt 2010-01-15 20:22:33 +0000
268+++ lib/lp/code/templates/branch-index.pt 2010-03-11 19:22:24 +0000
269@@ -44,18 +44,18 @@
270 <script type="text/javascript"
271 tal:content="string:
272 LPS.use('node', 'event', 'widget', 'plugin', 'overlay',
273- 'lazr.choiceedit', 'code.branchstatus',
274- 'code.branchmergeproposal.popupdiff',
275- 'code.branch.subscription', function(Y) {
276+ 'lazr.choiceedit', 'lp.code.branchstatus',
277+ 'lp.code.branchmergeproposal.popupdiff',
278+ 'lp.code.branch.subscription', function(Y) {
279
280 Y.on('load', function(e) {
281- var subscription_portlet = new Y.code.branch.subscription.SubscriptionWidget({
282+ var subscription_portlet = new Y.lp.code.branch.subscription.SubscriptionWidget({
283 contentBox: '#portlet-subscribers'
284 });
285 subscription_portlet.render();
286
287- Y.branchstatus.connect_status(${view/status_config});
288- Y.code.branchmergeproposal.popupdiff.connect_diff_links();
289+ Y.lp.code.branchstatus.connect_status(${view/status_config});
290+ Y.lp.code.branchmergeproposal.popupdiff.connect_diff_links();
291 },
292 window);
293 });
294
295=== modified file 'lib/lp/code/templates/branch-related-bugs-specs.pt'
296--- lib/lp/code/templates/branch-related-bugs-specs.pt 2009-12-03 18:33:22 +0000
297+++ lib/lp/code/templates/branch-related-bugs-specs.pt 2010-03-11 19:22:24 +0000
298@@ -42,14 +42,14 @@
299 string:&lt;script id='branchlink-script' type='text/javascript'&gt;" />
300 <!--
301
302- LPS.use('io-base', 'code.branchlinks', function(Y) {
303+ LPS.use('io-base', 'lp.code.branchlinks', function(Y) {
304
305 if(Y.UA.ie) {
306 return;
307 }
308
309 Y.on('domready', function() {
310- Y.code.branchlinks.connect_branchlinks();
311+ Y.lp.code.branchlinks.connect_branchlinks();
312 });
313
314 });
315
316=== modified file 'lib/lp/code/templates/branchmergeproposal-index.pt'
317--- lib/lp/code/templates/branchmergeproposal-index.pt 2010-02-23 09:31:13 +0000
318+++ lib/lp/code/templates/branchmergeproposal-index.pt 2010-03-11 19:22:24 +0000
319@@ -228,8 +228,8 @@
320 string:&lt;script id='codereview-script' type='text/javascript'&gt;" />
321 conf = <tal:status-config replace="view/status_config" />
322 <!--
323- LPS.use('io-base', 'code.codereview', 'code.branchmergeproposal', 'lp.comment',
324- function(Y) {
325+ LPS.use('io-base', 'lp.code.codereview', 'lp.code.branchmergeproposal',
326+ 'lp.comment', function(Y) {
327
328 Y.on('load', function() {
329 var logged_in = LP.client.links['me'] !== undefined;
330@@ -242,10 +242,10 @@
331 return;
332 }
333
334- Y.code.branchmergeproposal.connect_status(conf);
335+ Y.lp.code.branchmergeproposal.connect_status(conf);
336 }
337- Y.code.codereview.connect_links();
338- (new Y.codereview.NumberToggle()).render();
339+ Y.lp.code.codereview.connect_links();
340+ (new Y.lp.code.codereview.NumberToggle()).render();
341 }, window);
342 });
343 -->