Merge lp:~gmb/launchpad/lazr-wizard-linkage into lp:launchpad

Proposed by Graham Binns on 2010-12-03
Status: Merged
Approved by: Graham Binns on 2010-12-03
Approved revision: no longer in the source branch.
Merged at revision: 12034
Proposed branch: lp:~gmb/launchpad/lazr-wizard-linkage
Merge into: lp:launchpad
Diff against target: 86 lines (+29/-13)
2 files modified
lib/lp/bugs/javascript/bug_subscription_widget.js (+17/-9)
lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js (+12/-4)
To merge this branch: bzr merge lp:~gmb/launchpad/lazr-wizard-linkage
Reviewer Review Type Date Requested Status
Graham Binns (community) code Approve on 2010-12-03
Abel Deuring (community) js 2010-12-03 Approve on 2010-12-03
Review via email: mp+42616@code.launchpad.net

Commit Message

[r=gmb][ui=none] [r=abel][ui=none][bug=684692] The new subscription widget has been updated to use lazr.wizard.Wizard rather than lazr.FormOverlay.

Description of the Change

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.

To post a comment you must log in.
Abel Deuring (adeuring) :
review: Approve (js)
Graham Binns (gmb) wrote :

Adding an r=me for code to satisfy our tools.

review: Approve (code)
Graham Binns (gmb) wrote :

On 3 December 2010 13:21, Graham Binns <email address hidden> wrote:
> The proposal to merge lp:~gmb/launchpad/lazr-wizard-linkage into lp:launchpad has been updated.
>
> Commit Message changed to:
>
> [r=gmb][ui=none][bug=684692] The new subscription widget has been updated to use lazr.wizard.Wizard rather than lazr.FormOverlay.
>

ARGH. Not what was meant to happen.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/bugs/javascript/bug_subscription_widget.js'
2--- lib/lp/bugs/javascript/bug_subscription_widget.js 2010-08-20 14:12:22 +0000
3+++ lib/lp/bugs/javascript/bug_subscription_widget.js 2010-12-03 12:42:12 +0000
4@@ -18,7 +18,7 @@
5 '<button type="button" name="field.actions.cancel" ' +
6 'class="lazr-neg lazr-btn" >Cancel</button>';
7
8-namespace.create_subscription_overlay = function() {
9+namespace.create_subscription_wizard = function() {
10 // Construct the form. This is a bit hackish but it saves us from
11 // having to try to get information from TAL into JavaScript and all
12 // the horror that entails.
13@@ -68,18 +68,26 @@
14 '</div>';
15
16 // Create the do-you-want-to-subscribe FormOverlay.
17- var subscribe_form_overlay = new Y.lazr.FormOverlay({
18+ var wizard_steps = [
19+ new Y.lazr.wizard.Step({
20+ form_content: subscribe_form_body,
21+ form_submit_button: Y.Node.create(submit_button_html),
22+ form_cancel_button: Y.Node.create(cancel_button_html),
23+ funcLoad: function() {},
24+ funcCleanUp: function() {}
25+ })
26+ ];
27+ var subscribe_wizard = new Y.lazr.wizard.Wizard({
28 headerContent: '<h2>Subscribe to this bug</h2>',
29- form_content: subscribe_form_body,
30- form_submit_button: Y.Node.create(submit_button_html),
31- form_cancel_button: Y.Node.create(cancel_button_html),
32 centered: true,
33- visible: false
34+ visible: false,
35+ steps: wizard_steps
36 });
37- subscribe_form_overlay.render('#subscribe-overlay');
38+ subscribe_wizard.render('#subscribe-wizard');
39
40- return subscribe_form_overlay;
41+ return subscribe_wizard;
42 };
43
44 }, "0.1", {"requires": [
45- "base", "io", "oop", "node", "event", "lazr.formoverlay", "lazr.effects"]});
46+ "base", "io", "oop", "node", "event", "lazr.formoverlay",
47+ "lazr.effects", "lazr.wizard"]});
48
49=== modified file 'lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js'
50--- lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js 2010-11-10 15:33:47 +0000
51+++ lib/lp/bugs/javascript/tests/test_bug_subscription_widget.js 2010-12-03 12:42:12 +0000
52@@ -22,6 +22,14 @@
53 setUp: function() {
54 // Monkeypatch LP.client to avoid network traffic and to make
55 // some things work as expected.
56+ window.LP = {
57+ client: {
58+ links: {},
59+ // Empty client constructor.
60+ Launchpad: function() {},
61+ cache: {}
62+ }
63+ };
64 LP.client.Launchpad.prototype.named_post =
65 function(url, func, config) {
66 config.on.success();
67@@ -29,15 +37,15 @@
68 LP.client.cache.bug = {
69 self_link: "http://bugs.example.com/bugs/1234"
70 };
71- this.subscribe_overlay =
72- Y.lp.bugs.bug_subscription_widget.create_subscription_overlay();
73- this.subscribe_overlay.show();
74+ this.subscribe_wizard =
75+ Y.lp.bugs.bug_subscription_widget.create_subscription_wizard();
76+ this.subscribe_wizard.show();
77 },
78
79 test_bug_notification_level_values: function() {
80 // The bug_notification_level field will have a value that's one
81 // of [Discussion, Details, Lifecycle].
82- var form_node = this.subscribe_overlay.form_node;
83+ var form_node = this.subscribe_wizard.form_node;
84 var notification_level_radio_buttons = form_node.queryAll(
85 'input[name=field.bug_notification_level]');
86 Y.each(notification_level_radio_buttons, function(obj) {