Merge lp:~gmb/lazr-js/wizard-widget into lp:lazr-js
| Status: | Merged |
|---|---|
| Approved by: | Graham Binns on 2010-09-23 |
| Approved revision: | 211 |
| Merged at revision: | 186 |
| Proposed branch: | lp:~gmb/lazr-js/wizard-widget |
| Merge into: | lp:lazr-js |
| Diff against target: |
1342 lines (+1280/-3) 8 files modified
examples/wizard/index.html (+110/-0) setup.py (+6/-3) src-js/lazrjs/formoverlay/formoverlay.js (+4/-0) src-js/lazrjs/wizard/assets/skins/sam/wizard-skin.css (+104/-0) src-js/lazrjs/wizard/assets/wizard-core.css (+50/-0) src-js/lazrjs/wizard/tests/wizard.html (+34/-0) src-js/lazrjs/wizard/tests/wizard.js (+752/-0) src-js/lazrjs/wizard/wizard.js (+220/-0) |
| To merge this branch: | bzr merge lp:~gmb/lazr-js/wizard-widget |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Paul Hummer (community) | js | 2010-09-17 | Approve on 2010-09-21 |
| Brad Crittenden (community) | code | Approve on 2010-09-17 | |
|
Review via email:
|
|||
Commit Message
Add a Wizard widget.
Description of the Change
This branch complete's Paul's work on adding a Wizard (multi-step FormOverlay) widget to LAZR-JS.
The Widget is a fairly simple extension to lazr.FormOverlay. It contains next() and previous() methods which allow us to move through its steps. It's up to whatever uses the Wizard to call those methods.
The Step class isn't really a class so much as a container for logic. It has a form_content attribute, which contains whatever HTML should be displayed when the step is loaded, and callbacks funcLoad and funcCleanUp, which are called when the step is loaded and when it is superseded by another step respectively.
- 207. By Graham Binns on 2010-09-17
-
Minor tweak.
- 208. By Graham Binns on 2010-09-17
-
Fixed brokenness.
- 209. By Graham Binns on 2010-09-17
-
Added a comment to make the horrendous testing of erroring tests nonsense a little bit clearer.
- 210. By Graham Binns on 2010-09-17
-
Removed unnecessary check for steps.
| Paul Hummer (rockstar) wrote : | # |
So, we discussed on the phone that we should have Wizard.destroy() handling the destruction of the whole widget, and we also discussed actually firing the event instead of calling the function we set up to be the event default. Fix those and land it.
| Graham Binns (gmb) wrote : | # |
Hi Brad,
> > === modified file 'src-js/
> > --- src-js/
> > +++ src-js/
> > @@ -190,6 +190,9 @@
> >
> > Y.extend(
> >
> > + initializer: function() {
> > + /* Do nothing */
>
> A comment here that the method is meant to be overridden by subclasses
> might be useful.
>
> The comment should be a complete sentence with punctuation.
>
Done.
> > + },
> > /**
> > * Create the nodes for the form and add them to the contentBody.
> > * <p>
>
> > === added directory 'src-js/
> > === added directory 'src-js/
> > === added directory 'src-js/
> > === added directory 'src-js/
> > === added file 'src-js/
> > --- src-js/
> > +++ src-js/
>
> sam?
No idea.
> > @@ -0,0 +1,104 @@
> > +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */
>
> 2010
>
> > +.yui3-wizard .step-off,
> > +.yui3-wizard .step-offb {
> > + background: gray url('images/
>
> What an odd file name.
Yep. Again, not a clue.
> > === added directory 'src-js/
> > === added file 'src-js/
> > --- src-js/
> > +++ src-js/
> > @@ -0,0 +1,34 @@
> > +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://
> > +<html>
> > + <head>
> > + <title>Form Overlay</title>
> > +
> > + <!-- YUI 3.0 Setup -->
> > + <script type="text/
> > + <link rel="stylesheet" href=".
> > + <link rel="stylesheet" href=".
> > + <link rel="stylesheet" href=".
> > + <link rel="stylesheet" href=".
> > +
> > + <!-- dependent modules from lazr-->
>
> Capitalize the comment and use punctuation. Please apply to all comments.
Done.
> > + <script type="text/
> > + <script type="text/
> > + <script type="text/
> > + <script type="text/
> > +
> > + <!-- The module under test -->
> > + <script type="text/
> > +
> > + <!-- Testing helpers -->
> > + <script type="text/
> > +
> > + <!-- The test suite -->
> > + <script type="text/
> > +
> > +</head>
> > +<body class="
> > + <div id="form_
> > + </div>
> > + <div id="log...
- 211. By Graham Binns on 2010-09-23
-
Review changes for Brad.
- 212. By Graham Binns on 2010-09-23
-
Fixed addStep.
- 213. By Graham Binns on 2010-09-23
-
Added a destructor.
- 214. By Graham Binns on 2010-09-23
-
Typo fix.
| Paul Hummer (rockstar) wrote : | # |
On Thu, 23 Sep 2010 13:47:41 -0000
Graham Binns <email address hidden> wrote:
> > > + },
> > > /**
> > > * Create the nodes for the form and add them to the
> > > contentBody.
> > > * <p>
> >
> > > === added directory 'src-js/
> > > === added directory 'src-js/
> > > === added directory 'src-js/
> > > === added directory 'src-js/
> > > === added file
> > > 'src-js/
> > > src-js/
> > > 1970-01-01 00:00:00 +0000 +++
> > > src-js/
> > > 2010-09-17 14:41:35 +0000
> >
> > sam?
>
> No idea.
>
This is the default skin name for YUI. I hate that we use it, but we
do. :( I'm not sure why we can't have a lazrjs skin name that we
use. It would make more sense.
> > > @@ -0,0 +1,104 @@
> > > +/* Copyright (c) 2009, Canonical Ltd. All rights reserved. */
> >
> > 2010
> >
> > > +.yui3-wizard .step-off,
> > > +.yui3-wizard .step-offb {
> > > + background: gray url('images/
> > > repeat-x;
> >
> > What an odd file name.
>
> Yep. Again, not a clue.
>
Please file a bug about this. It makes no sense, but it's legacy.
A lot of the lazr-js codebase is proof that when it comes to
javascript, we're still fumbling around a lot. I hope to get some
standards set up soon, but the simple fact is that there's lots of
hidden (and some not so hidden) oddities about lazr-js.
Cheers,
Paul

Hi Graham,
Thanks for the feedback on IRC.
This branch looks good but I've noted some issues, most of them trivial. I do encourage you to have a more experienced JS reviewer look at this branch but I'm glad I reviewed it as I learned quite a bit.
--Brad
> === added directory 'examples/wizard' wizard/ index.html' wizard/ index.html 1970-01-01 00:00:00 +0000 wizard/ index.html 2010-09-17 14:41:35 +0000
> === added file 'examples/
> --- examples/
+++ examples/
Thanks for fixing the issue we discussed on IRC. It is good to have a
working example even if it isn't as nice as you'd like.
> @@ -0,0 +1,102 @@ www.w3. org/TR/ xhtml1/ DTD/xhtml1- strict. dtd"> www.w3. org/1999/ xhtml" xml:lang="en" lang="en"> ./../build/ cssreset/ reset-min. css" /> ./../build/ cssfonts/ fonts-min. css" /> ./../build/ cssbase/ base-min. css" /> "content- type" content= "text/html; charset= utf-8" /> javascript" src=".. /../build/ yui/yui- min.js" ></script> javascript" src=".. /../build/ lazr/lazr- meta.js" ></script> javascript" > yui3-skin- sam"> ion</h2> open">Re- open the wizard to test again</a></p> javascript" > YUI_CONFIG) .use('cssreset' , 'cssfonts', 'cssbase', push(new Y.lazr. wizard. Step({ next-step" type="button" value="Next" />', query(' input#wizard- next-step' ).on( on(); push(new Y.lazr. wizard. Step({
> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> + "http://
> +<html xmlns="http://
> +<head>
> + <title>LAZR JS Examples: lazr.wizard</title>
> +
> + <link rel="stylesheet" type="text/css" href=".
> + <link rel="stylesheet" type="text/css" href=".
> + <link rel="stylesheet" type="text/css" href=".
> + <meta http-equiv=
> +
> + <script type="text/
> + <script type="text/
> + <script type="text/
> + var LAZR_YUI_CONFIG = {
> + filter: "min",
> + base: "../../build/",
> + modules: LAZR_MODULES,
> + };
> + </script>
> +</head>
> +
> +<body class="
> +<h1>The lazr.wizard module</h1>
> +
> +The lazr.wizard module has two widgets in it: <code>Wizard</code> and
> +<code>Step</code>.
> +
> +<h2>Wizard</h2>
> +A wizard can have multiple steps. You can add steps by calling Wizard.addStep.
> +
> +<h2>Step</h2>
> +A step is not really a widget. It merely has a load() and a cleanup() that are
> +called by the Wizard when it moves through its steps.
> +
> +<h2>Demonstrat
> +<p><a href="#" id="re-
> +
> +<script type="text/
> +YUI(LAZR_
> + 'lazr.wizard', 'node', 'event',
> + 'dump', function(Y) {
> +
> + var wizardSteps = [];
> + wizardSteps.
> + title: "Step One",
> + form_content: [
> + '<p>You are now on step 1.</p>',
> + '<p>',
> + ' <input id="wizard-
> + '</p>'
> + ].join("\n"),
> + funcLoad: function(wizard) {
> + Y.log("Step One load");
> + var form_node = wizard.form_node;
> + form_node.
> + 'click', function(e) {
> + e.stopPropagati
> + wizard.next();
> + });
> + },
> + funcCleanUp: function() { Y.log("Step One cleanup"); }
> + }));
> + wizardSteps.
> + title: "Step Two",
> + form_content: [
> + '<p>...