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

Proposed by Paul Hummer
Status: Merged
Approved by: Michael Hudson-Doyle
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~rockstar/launchpad/code-js-file-reorg
Merge into: lp:launchpad
Prerequisite: lp:~rockstar/launchpad/code-js-reorg
Diff against target: 244 lines (+44/-45)
10 files modified
lib/canonical/launchpad/javascript/code/branch.bugspeclinks.js (+2/-2)
lib/canonical/launchpad/javascript/code/branch.status.js (+3/-4)
lib/canonical/launchpad/javascript/code/branchmergeproposal.diff.js (+3/-3)
lib/canonical/launchpad/javascript/code/branchmergeproposal.reviewcomment.js (+3/-3)
lib/canonical/launchpad/javascript/code/branchmergeproposal.status.js (+2/-2)
lib/lp/app/templates/base-layout-macros.pt (+17/-4)
lib/lp/bugs/templates/bugtask-index.pt (+2/-2)
lib/lp/code/templates/branch-index.pt (+4/-18)
lib/lp/code/templates/branch-related-bugs-specs.pt (+2/-2)
lib/lp/code/templates/branchmergeproposal-index.pt (+6/-5)
To merge this branch: bzr merge lp:~rockstar/launchpad/code-js-file-reorg
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle Approve
Review via email: mp+21085@code.launchpad.net

Description of the change

In the early days of javascript, no sheriff meant no law. No law meant crime
was at an all time high.

This branch basically removes some of our javascript crimes. Specifically,
when we created javascript, we named the file and namespace whatever seemed to
work. When everyone has their own ideas on how this works, it means we have a
great amount of inconsistency. I changed this by naming the javascript files
to be <model>.<attribute>.js in the code javascript. This also meant that I
needed to change some of the YUI namespaces.

All the windmill tests pass, etc.

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks suitably boring. Is the code going to move into lib/lp/code at some point?

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== renamed file 'lib/canonical/launchpad/javascript/code/branchlinks.js' => 'lib/canonical/launchpad/javascript/code/branch.bugspeclinks.js'
--- lib/canonical/launchpad/javascript/code/branchlinks.js 2010-03-11 23:28:28 +0000
+++ lib/canonical/launchpad/javascript/code/branch.bugspeclinks.js 2010-03-11 23:28:30 +0000
@@ -7,9 +7,9 @@
7 * @requires base, lazr.anim, lazr.formoverlay7 * @requires base, lazr.anim, lazr.formoverlay
8 */8 */
99
10YUI.add('lp.code.branchlinks', function(Y) {10YUI.add('lp.code.branch.bugspeclinks', function(Y) {
1111
12var namespace = Y.namespace('lp.code.branchlinks');12var namespace = Y.namespace('lp.code.branch.bugspeclinks');
1313
14var lp_client; // The LP client14var lp_client; // The LP client
1515
1616
=== renamed file 'lib/canonical/launchpad/javascript/code/branchstatus.js' => 'lib/canonical/launchpad/javascript/code/branch.status.js'
--- lib/canonical/launchpad/javascript/code/branchstatus.js 2010-03-11 23:28:28 +0000
+++ lib/canonical/launchpad/javascript/code/branch.status.js 2010-03-11 23:28:30 +0000
@@ -7,9 +7,9 @@
7 * @requires node, lazr.choiceedit, lp.client.plugins7 * @requires node, lazr.choiceedit, lp.client.plugins
8 */8 */
99
10YUI.add('lp.code.branchstatus', function(Y) {10YUI.add('lp.code.branch.status', function(Y) {
1111
12var namespace = Y.namespace('lp.code.branchstatus');12var namespace = Y.namespace('lp.code.branch.status');
1313
14/*14/*
15 * Connect the branch status to the javascript events.15 * Connect the branch status to the javascript events.
@@ -18,8 +18,7 @@
1818
19 var status_content = Y.one('#branch-details-status-value');19 var status_content = Y.one('#branch-details-status-value');
2020
21 if21 if (conf.user_can_edit_status) {
22 (conf.user_can_edit_status) {
23 var status_choice_edit = new Y.ChoiceSource({22 var status_choice_edit = new Y.ChoiceSource({
24 contentBox: status_content,23 contentBox: status_content,
25 value: conf.status_value,24 value: conf.status_value,
2625
=== renamed file 'lib/canonical/launchpad/javascript/code/subscription.js' => 'lib/canonical/launchpad/javascript/code/branch.subscription.js'
=== renamed file 'lib/canonical/launchpad/javascript/code/popupdiff.js' => 'lib/canonical/launchpad/javascript/code/branchmergeproposal.diff.js'
--- lib/canonical/launchpad/javascript/code/popupdiff.js 2010-03-11 23:28:28 +0000
+++ lib/canonical/launchpad/javascript/code/branchmergeproposal.diff.js 2010-03-11 23:28:30 +0000
@@ -3,14 +3,14 @@
3 *3 *
4 * Code for handling the popup diffs in the pretty overlays.4 * Code for handling the popup diffs in the pretty overlays.
5 *5 *
6 * @module lp.code.branchmergeproposal.popupdiff6 * @module lp.code.branchmergeproposal.diff
7 * @requires node7 * @requires node
8 */8 */
99
10YUI.add('lp.code.branchmergeproposal.popupdiff', function(Y) {10YUI.add('lp.code.branchmergeproposal.diff', function(Y) {
1111
12// Grab the namespace in order to be able to expose the connect method.12// Grab the namespace in order to be able to expose the connect method.
13var namespace = Y.namespace('lp.code.branchmergeproposal.popupdiff');13var namespace = Y.namespace('lp.code.branchmergeproposal.diff');
1414
15// The launchpad js client used.15// The launchpad js client used.
16var lp_client;16var lp_client;
1717
=== renamed file 'lib/canonical/launchpad/javascript/code/codereview.js' => 'lib/canonical/launchpad/javascript/code/branchmergeproposal.reviewcomment.js'
--- lib/canonical/launchpad/javascript/code/codereview.js 2010-03-11 23:28:28 +0000
+++ lib/canonical/launchpad/javascript/code/branchmergeproposal.reviewcomment.js 2010-03-11 23:28:30 +0000
@@ -3,13 +3,13 @@
3 *3 *
4 * Library for code review javascript.4 * Library for code review javascript.
5 *5 *
6 * @module lp.code.codereview6 * @module lp.code.branchmergeproposal.reviewcomment
7 * @requires base, lazr.anim, lazr.formoverlay7 * @requires base, lazr.anim, lazr.formoverlay
8 */8 */
99
10YUI.add('lp.code.codereview', function(Y) {10YUI.add('lp.code.branchmergeproposal.reviewcomment', function(Y) {
1111
12var namespace = Y.namespace('lp.code.codereview');12var namespace = Y.namespace('lp.code.branchmergeproposal.reviewcomment');
1313
14var reviewer_picker; // The "Request a review" overlay14var reviewer_picker; // The "Request a review" overlay
15var lp_client;15var lp_client;
1616
=== renamed file 'lib/canonical/launchpad/javascript/code/branchmergeproposal.js' => 'lib/canonical/launchpad/javascript/code/branchmergeproposal.status.js'
--- lib/canonical/launchpad/javascript/code/branchmergeproposal.js 2010-03-11 23:28:28 +0000
+++ lib/canonical/launchpad/javascript/code/branchmergeproposal.status.js 2010-03-11 23:28:30 +0000
@@ -6,9 +6,9 @@
6 * @requires node, lazr.choiceedit, lp.client.plugins6 * @requires node, lazr.choiceedit, lp.client.plugins
7 */7 */
88
9YUI.add('lp.code.branchmergeproposal', function(Y) {9YUI.add('lp.code.branchmergeproposal.status', function(Y) {
1010
11var namespace = Y.namespace('lp.code.branchmergeproposal');11var namespace = Y.namespace('lp.code.branchmergeproposal.status');
1212
13/*13/*
14 * Connect the branch status to the javascript events.14 * Connect the branch status to the javascript events.
1515
=== modified file 'lib/lp/app/templates/base-layout-macros.pt'
--- lib/lp/app/templates/base-layout-macros.pt 2010-03-09 18:41:20 +0000
+++ lib/lp/app/templates/base-layout-macros.pt 2010-03-11 23:28:30 +0000
@@ -187,10 +187,23 @@
187 tal:attributes="src string:${lp_js}/client/client.js"></script>187 tal:attributes="src string:${lp_js}/client/client.js"></script>
188188
189 <script type="text/javascript"189 <script type="text/javascript"
190 tal:attributes="src string:${lp_js}/code/branchmergeproposal.js">190 tal:attributes="src string:${lp_js}/code/branch.bugspeclinks.js">
191 </script>191 </script>
192 <script type="text/javascript"192 <script type="text/javascript"
193 tal:attributes="src string:${lp_js}/code/codereview.js"></script>193 tal:attributes="src string:${lp_js}/code/branch.status.js">
194 </script>
195 <script type="text/javascript"
196 tal:attributes="src string:${lp_js}/code/branchmergeproposal.diff.js">
197 </script>
198 <script type="text/javascript"
199 tal:attributes="src string:${lp_js}/code/branch.subscription.js">
200 </script>
201 <script type="text/javascript"
202 tal:attributes="src string:${lp_js}/code/branchmergeproposal.status.js">
203 </script>
204 <script type="text/javascript"
205 tal:attributes="src string:${lp_js}/code/branchmergeproposal.reviewcomment.js"></script>
206
194 <script type="text/javascript"207 <script type="text/javascript"
195 tal:attributes="src string:${lp_js}/lp/comment.js"></script>208 tal:attributes="src string:${lp_js}/lp/comment.js"></script>
196 <script type="text/javascript"209 <script type="text/javascript"
197210
=== modified file 'lib/lp/bugs/templates/bugtask-index.pt'
--- lib/lp/bugs/templates/bugtask-index.pt 2010-03-11 23:28:28 +0000
+++ lib/lp/bugs/templates/bugtask-index.pt 2010-03-11 23:28:30 +0000
@@ -38,10 +38,10 @@
38 </tal:devmode>38 </tal:devmode>
39 <script type="text/javascript">39 <script type="text/javascript">
40 LPS.use('base', 'node', 'oop', 'event', 'bugs.bugtask_index',40 LPS.use('base', 'node', 'oop', 'event', 'bugs.bugtask_index',
41 'lp.code.branchmergeproposal.popupdiff', function(Y) {41 'lp.code.branchmergeproposal.diff', function(Y) {
42 Y.bugs.setup_bugtask_index();42 Y.bugs.setup_bugtask_index();
43 Y.on('load', function(e) {43 Y.on('load', function(e) {
44 Y.lp.code.branchmergeproposal.popupdiff.connect_diff_links();44 Y.lp.code.branchmergeproposal.diff.connect_diff_links();
45 }, window);45 }, window);
46 });46 });
47 </script>47 </script>
4848
=== modified file 'lib/lp/code/templates/branch-index.pt'
--- lib/lp/code/templates/branch-index.pt 2010-03-11 23:28:28 +0000
+++ lib/lp/code/templates/branch-index.pt 2010-03-11 23:28:30 +0000
@@ -27,25 +27,11 @@
27 }27 }
2828
29 </style>29 </style>
30 <tal:devmode condition="devmode">
31 <script type="text/javascript"
32 tal:attributes="src string:${lp_js}/code/branchlinks.js">
33 </script>
34 <script type="text/javascript"
35 tal:attributes="src string:${lp_js}/code/branchstatus.js">
36 </script>
37 <script type="text/javascript"
38 tal:attributes="src string:${lp_js}/code/popupdiff.js">
39 </script>
40 <script type="text/javascript"
41 tal:attributes="src string:${lp_js}/code/subscription.js">
42 </script>
43 </tal:devmode>
44 <script type="text/javascript"30 <script type="text/javascript"
45 tal:content="string:31 tal:content="string:
46 LPS.use('node', 'event', 'widget', 'plugin', 'overlay',32 LPS.use('node', 'event', 'widget', 'plugin', 'overlay',
47 'lazr.choiceedit', 'lp.code.branchstatus',33 'lazr.choiceedit', 'lp.code.branch.status',
48 'lp.code.branchmergeproposal.popupdiff',34 'lp.code.branchmergeproposal.diff',
49 'lp.code.branch.subscription', function(Y) {35 'lp.code.branch.subscription', function(Y) {
5036
51 Y.on('load', function(e) {37 Y.on('load', function(e) {
@@ -54,8 +40,8 @@
54 });40 });
55 subscription_portlet.render();41 subscription_portlet.render();
5642
57 Y.lp.code.branchstatus.connect_status(${view/status_config});43 Y.lp.code.branch.status.connect_status(${view/status_config});
58 Y.lp.code.branchmergeproposal.popupdiff.connect_diff_links();44 Y.lp.code.branchmergeproposal.diff.connect_diff_links();
59 },45 },
60 window);46 window);
61 });47 });
6248
=== modified file 'lib/lp/code/templates/branch-related-bugs-specs.pt'
--- lib/lp/code/templates/branch-related-bugs-specs.pt 2010-03-11 23:28:28 +0000
+++ lib/lp/code/templates/branch-related-bugs-specs.pt 2010-03-11 23:28:30 +0000
@@ -42,14 +42,14 @@
42 string:&lt;script id='branchlink-script' type='text/javascript'&gt;" />42 string:&lt;script id='branchlink-script' type='text/javascript'&gt;" />
43 <!--43 <!--
4444
45 LPS.use('io-base', 'lp.code.branchlinks', function(Y) {45 LPS.use('io-base', 'lp.code.branch.bugspeclinks', function(Y) {
4646
47 if(Y.UA.ie) {47 if(Y.UA.ie) {
48 return;48 return;
49 }49 }
5050
51 Y.on('domready', function() {51 Y.on('domready', function() {
52 Y.lp.code.branchlinks.connect_branchlinks();52 Y.lp.code.branch.bugspeclinks.connect_branchlinks();
53 });53 });
5454
55 });55 });
5656
=== modified file 'lib/lp/code/templates/branchmergeproposal-index.pt'
--- lib/lp/code/templates/branchmergeproposal-index.pt 2010-03-11 23:28:28 +0000
+++ lib/lp/code/templates/branchmergeproposal-index.pt 2010-03-11 23:28:30 +0000
@@ -228,8 +228,8 @@
228 string:&lt;script id='codereview-script' type='text/javascript'&gt;" />228 string:&lt;script id='codereview-script' type='text/javascript'&gt;" />
229 conf = <tal:status-config replace="view/status_config" />229 conf = <tal:status-config replace="view/status_config" />
230 <!--230 <!--
231 LPS.use('io-base', 'lp.code.codereview', 'lp.code.branchmergeproposal',231 LPS.use('io-base', 'lp.code.branchmergeproposal.reviewcomment',
232 'lp.comment', function(Y) {232 'lp.code.branchmergeproposal.status', 'lp.comment', function(Y) {
233233
234 Y.on('load', function() {234 Y.on('load', function() {
235 var logged_in = LP.client.links['me'] !== undefined;235 var logged_in = LP.client.links['me'] !== undefined;
@@ -242,10 +242,11 @@
242 return;242 return;
243 }243 }
244244
245 Y.lp.code.branchmergeproposal.connect_status(conf);245 Y.lp.code.branchmergeproposal.status.connect_status(conf);
246 }246 }
247 Y.lp.code.codereview.connect_links();247 Y.lp.code.branchmergeproposal.reviewcomment.connect_links();
248 (new Y.lp.code.codereview.NumberToggle()).render();248 (new Y.lp.code.branchmergeproposal.reviewcomment.NumberToggle()
249 ).render();
249 }, window);250 }, window);
250 });251 });
251 -->252 -->