launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #02099
[Merge] lp:~gmb/launchpad/lazr-wizard-linkage into lp:launchpad
Graham Binns has proposed merging lp:~gmb/launchpad/lazr-wizard-linkage into lp:launchpad.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
#684692 The new subscription overlay should use Y.lazr.wizard.Wizard
https://bugs.launchpad.net/bugs/684692
This branch fixes bug 684692 by updating the JS for the new subscription
widget to use lazr.wizard.Wizard rather than a FormOverlay. I've updated
the method implementation and I've change variable names as necessary.
I've also updated the (rather meagre) tests.
This is a small value-add branch to save me from madness in the coming
week.
--
https://code.launchpad.net/~gmb/launchpad/lazr-wizard-linkage/+merge/42616
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~gmb/launchpad/lazr-wizard-linkage into lp:launchpad.
=== modified file 'lib/lp/bugs/javascript/bug_subscription_widget.js'
--- lib/lp/bugs/javascript/bug_subscription_widget.js 2010-08-20 14:12:22 +0000
+++ lib/lp/bugs/javascript/bug_subscription_widget.js 2010-12-03 12:42:12 +0000
@@ -18,7 +18,7 @@
'<button type="button" name="field.actions.cancel" ' +
'class="lazr-neg lazr-btn" >Cancel</button>';
-namespace.create_subscription_overlay = function() {
+namespace.create_subscription_wizard = function() {
// Construct the form. This is a bit hackish but it saves us from
// having to try to get information from TAL into JavaScript and all
// the horror that entails.
@@ -68,18 +68,26 @@
'</div>';
// Create the do-you-want-to-subscribe FormOverlay.
- var subscribe_form_overlay = new Y.lazr.FormOverlay({
+ var wizard_steps = [
+ new Y.lazr.wizard.Step({
+ form_content: subscribe_form_body,
+ form_submit_button: Y.Node.create(submit_button_html),
+ form_cancel_button: Y.Node.create(cancel_button_html),
+ funcLoad: function() {},
+ funcCleanUp: function() {}
+ })
+ ];
+ var subscribe_wizard = new Y.lazr.wizard.Wizard({
headerContent: '<h2>Subscribe to this bug</h2>',
- form_content: subscribe_form_body,
- form_submit_button: Y.Node.create(submit_button_html),
- form_cancel_button: Y.Node.create(cancel_button_html),
centered: true,
- visible: false
+ visible: false,
+ steps: wizard_steps
});
- subscribe_form_overlay.render('#subscribe-overlay');
+ subscribe_wizard.render('#subscribe-wizard');
- return subscribe_form_overlay;
+ return subscribe_wizard;
};
}, "0.1", {"requires": [
- "base", "io", "oop", "node", "event", "lazr.formoverlay", "lazr.effects"]});
+ "base", "io", "oop", "node", "event", "lazr.formoverlay",
+ "lazr.effects", "lazr.wizard"]});
=== modified file 'lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js'
--- lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js 2010-11-10 15:33:47 +0000
+++ lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js 2010-12-03 12:42:12 +0000
@@ -22,6 +22,14 @@
setUp: function() {
// Monkeypatch LP.client to avoid network traffic and to make
// some things work as expected.
+ window.LP = {
+ client: {
+ links: {},
+ // Empty client constructor.
+ Launchpad: function() {},
+ cache: {}
+ }
+ };
LP.client.Launchpad.prototype.named_post =
function(url, func, config) {
config.on.success();
@@ -29,15 +37,15 @@
LP.client.cache.bug = {
self_link: "http://bugs.example.com/bugs/1234"
};
- this.subscribe_overlay =
- Y.lp.bugs.bug_subscription_widget.create_subscription_overlay();
- this.subscribe_overlay.show();
+ this.subscribe_wizard =
+ Y.lp.bugs.bug_subscription_widget.create_subscription_wizard();
+ this.subscribe_wizard.show();
},
test_bug_notification_level_values: function() {
// The bug_notification_level field will have a value that's one
// of [Discussion, Details, Lifecycle].
- var form_node = this.subscribe_overlay.form_node;
+ var form_node = this.subscribe_wizard.form_node;
var notification_level_radio_buttons = form_node.queryAll(
'input[name=field.bug_notification_level]');
Y.each(notification_level_radio_buttons, function(obj) {