launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #06104
[Merge] lp:~wallyworld/launchpad/more-mochikit-fallout into lp:launchpad
Ian Booth has proposed merging lp:~wallyworld/launchpad/more-mochikit-fallout into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~wallyworld/launchpad/more-mochikit-fallout/+merge/88814
Fix last remaining (hopefully) fallout from removing mochikit.
1. Port more connect() calls found in TAL to use Y.on()
2. Fix a trim() call -> Y.Lang.trim()
3. Fix a selector in comment.js div#add-comment-form -> #add-comment-form
Tested locally.
--
https://code.launchpad.net/~wallyworld/launchpad/more-mochikit-fallout/+merge/88814
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~wallyworld/launchpad/more-mochikit-fallout into lp:launchpad.
=== modified file 'lib/lp/app/javascript/comment.js'
--- lib/lp/app/javascript/comment.js 2012-01-12 10:40:07 +0000
+++ lib/lp/app/javascript/comment.js 2012-01-17 07:11:25 +0000
@@ -21,7 +21,8 @@
initializer: function() {
this.submit_button = this.get_submit();
this.comment_input = Y.one(
- 'div#add-comment-form [id="field.comment"]');
+ '#add-comment-form [id="field.comment"]');
+
this.lp_client = new Y.lp.client.Launchpad();
this.error_handler = new Y.lp.client.ErrorHandler();
this.error_handler.clearProgressUI = Y.bind(
@@ -41,7 +42,7 @@
* @method get_submit
*/
get_submit: function(){
- return Y.one('div#add-comment-form input[id="field.actions.save"]');
+ return Y.one('#add-comment-form input[id="field.actions.save"]');
},
/**
* Implementation of Widget.renderUI.
@@ -64,7 +65,7 @@
* @method validate
*/
validate: function() {
- return trim(this.comment_input.get('value')) !== '';
+ return Y.Lang.trim(this.comment_input.get('value')) !== '';
},
/**
* Make the widget enabled or disabled.
=== added file 'lib/lp/code/javascript/util.js'
--- lib/lp/code/javascript/util.js 1970-01-01 00:00:00 +0000
+++ lib/lp/code/javascript/util.js 2012-01-17 07:11:25 +0000
@@ -0,0 +1,60 @@
+/* Copyright 2012 Canonical Ltd. This software is licensed under the
+ * GNU Affero General Public License version 3 (see the file LICENSE).
+ *
+ * Control enabling/disabling form elements on the +new-recipe page.
+ *
+ * @module Y.lp.code.util
+ * @requires node
+ */
+YUI.add('lp.code.util', function(Y) {
+var ns = Y.namespace('lp.code.util');
+
+var update_branch_unique_name = function() {
+ var unique_name = Y.one("#branch-unique-name");
+ var owner = Y.one("[id='field.owner']").get('value');
+ var name = Y.one("[id='field.name']").get('value');
+ if (name == '') {
+ name = '<name>'
+ }
+ var branch_name = "~" + owner + "/" + target_name + "/" + name;
+ unique_name.setContent(branch_name);
+};
+
+var hookUpBranchFieldFunctions = function () {
+ var owner = Y.one("[id='field.owner']");
+ owner.on('keyup', update_branch_unique_name);
+ owner.on('change', update_branch_unique_name);
+ var name = Y.one("[id='field.name']");
+ name.on('keyup', update_branch_unique_name);
+ name.on('change', update_branch_unique_name);
+ Y.one('#branch-unique-name-div').setStyle('display', 'block');
+ update_branch_unique_name();
+};
+
+var hookUpBranchFilterSubmission = function() {
+ var submit_filter = function (e) {
+ Y.DOM.byId('filter_form').submit();
+ };
+
+ Y.one("[id='field.lifecycle']").on('change', submit_filter);
+ var sortby = Y.one("[id='field.sort_by']");
+ if (Y.Lang.isValue(sortby)) {
+ sortby.on('change', submit_filter)
+ }
+};
+
+var hookUpDailyBuildsFilterSubmission = function() {
+ var submit_filter = function (e) {
+ Y.DOM.byId('filter_form').submit();
+ };
+
+ Y.one("[id='field.when_completed_filter']").on(
+ 'change', submit_filter);
+};
+
+ns.hookUpBranchFieldFunctions = hookUpBranchFieldFunctions;
+ns.hookUpBranchFilterSubmission = hookUpBranchFilterSubmission;
+ns.hookUpDailyBuildsFilterSubmission = hookUpDailyBuildsFilterSubmission;
+
+}, "0.1", {"requires": ["node", "dom"]});
+
=== modified file 'lib/lp/code/templates/branch-form-macros.pt'
--- lib/lp/code/templates/branch-form-macros.pt 2011-11-26 04:03:29 +0000
+++ lib/lp/code/templates/branch-form-macros.pt 2012-01-17 07:11:25 +0000
@@ -17,28 +17,11 @@
<script type="text/javascript">
//<![CDATA[
-function update_branch_unique_name()
-{
- var unique_name = document.getElementById("branch-unique-name")
- var owner = document.getElementById("field.owner")
- var name = document.getElementById("field.name").value
- if (name == '') {
- name = '<name>'
- }
- var branch_name = "~" + owner.value + "/" + target_name + "/" + name
- unique_name.innerHTML = branch_name
-}
-
-function hookUpBranchFieldFunctions()
-{
- connect('field.owner', 'onkeyup', update_branch_unique_name);
- connect('field.owner', 'onchange', update_branch_unique_name);
- connect('field.name', 'onkeyup', update_branch_unique_name);
- update_branch_unique_name();
- document.getElementById("branch-unique-name-div").style.display = "block";
-}
-
-registerLaunchpadFunction(hookUpBranchFieldFunctions);
+LPS.use('lp.code.util', function(Y) {
+ Y.on('domready', function(e) {
+ Y.lp.code.util.hookUpBranchFieldFunctions(Y);
+ }, window);
+});
//]]>
</script>
=== modified file 'lib/lp/code/templates/branch-listing.pt'
--- lib/lp/code/templates/branch-listing.pt 2012-01-04 16:27:21 +0000
+++ lib/lp/code/templates/branch-listing.pt 2012-01-17 07:11:25 +0000
@@ -17,16 +17,6 @@
</form>
<script type="text/javascript">
-function submit_filter() {
- getElement('filter_form').submit();
-}
-
-function hookUpFilterSubmission () {
- connect('field.lifecycle', 'onchange', submit_filter);
- if (getElement('field.sort_by')) {
- connect('field.sort_by', 'onchange', submit_filter);
- }
-}
function show_commit(id) {
var div = document.getElementById('branch-log-' + id);
if (div) {
@@ -45,7 +35,11 @@
<tal:comment
tal:condition="not: request/features/ajax.batch_navigator.enabled"
replace='structure string:<script type="text/javascript">
- registerLaunchpadFunction(hookUpFilterSubmission);
+ LPS.use("lp.code.util", function(Y) {
+ Y.on("domready", function(e) {
+ Y.lp.code.util.hookUpBranchFilterSubmission(Y);
+ }, window);
+ });
</script>'/>
<tal:needs-batch condition="context/has_multiple_pages">
=== modified file 'lib/lp/code/templates/daily-builds-listing.pt'
--- lib/lp/code/templates/daily-builds-listing.pt 2011-03-02 13:22:31 +0000
+++ lib/lp/code/templates/daily-builds-listing.pt 2012-01-17 07:11:25 +0000
@@ -29,14 +29,11 @@
</form>
<script type="text/javascript">
- function submit_filter() {
- getElement('filter_form').submit();
- }
-
- function hookUpFilterSubmission () {
- connect('field.when_completed_filter', 'onchange', submit_filter);
- }
- registerLaunchpadFunction(hookUpFilterSubmission);
+ LPS.use("lp.code.util", function(Y) {
+ Y.on("domready", function(e) {
+ Y.lp.code.util.hookUpDailyBuildsFilterSubmission(Y);
+ }, window);
+ });
</script>
<tal:block tal:condition="not:dailybuilds">
Follow ups