[Lift] Re: Best way to write a wizard
On Sun, Sep 13, 2009 at 10:52 AM, Josh Suereth joshua.suer...@gmail.comwrote: All, I write to you (unfortunately still) as a lift n00b. I'm trying to modify a form such that it looks more wizard like. i.e. I want it to specifically state You've completed part 1, you're on step 2 of 5, etc. How should I accomplish this in view-first rendering? Normal MVC, I'd make one controll that redirects you to the appropriate wizard screen depending on what steps have already been accomplished (i.e. the controller figures out which step you're on and sends you to the appropraite view. In Lift, I'm thinking I have a few options: 1) Have my stateful snippet actually return the various pages in code. I'm not happy with this, as my view would reside in the controller, but I could git'r'done this way. Not really. You can have the templates for each phase of the wizard be separate files and use TemplateFinder.findAnyTemplate to load the template for the step of the wizard that you're on. This is akin to the controller-first choosing a template. 2) Attempt to learn the lift-wizard library (is this stable/released?) No. I need (and have not found) 2-3 uninterrupted days to get it done. Maybe next week (this week is JVM summit). While I think this is Lift's future, having a simpler set of tools for people to use (like Naftoli's bind-o-matic thing) is great. Give people a choice and let them use what's best for them. 3) Spend more time trying to be inventive. Anyone have any thoughts? - Josh -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Best way to write a wizard
Gotta love a tool called bind-o-matic. Is it available from Ronco? Does it come with bonus laxatives? But wait, there's more! Ugh. Chas. David Pollak wrote: On Sun, Sep 13, 2009 at 10:52 AM, Josh Suereth joshua.suer...@gmail.com mailto:joshua.suer...@gmail.com wrote: All, I write to you (unfortunately still) as a lift n00b. I'm trying to modify a form such that it looks more wizard like. i.e. I want it to specifically state You've completed part 1, you're on step 2 of 5, etc. How should I accomplish this in view-first rendering? Normal MVC, I'd make one controll that redirects you to the appropriate wizard screen depending on what steps have already been accomplished (i.e. the controller figures out which step you're on and sends you to the appropraite view. In Lift, I'm thinking I have a few options: 1) Have my stateful snippet actually return the various pages in code. I'm not happy with this, as my view would reside in the controller, but I could git'r'done this way. Not really. You can have the templates for each phase of the wizard be separate files and use TemplateFinder.findAnyTemplate to load the template for the step of the wizard that you're on. This is akin to the controller-first choosing a template. 2) Attempt to learn the lift-wizard library (is this stable/released?) No. I need (and have not found) 2-3 uninterrupted days to get it done. Maybe next week (this week is JVM summit). While I think this is Lift's future, having a simpler set of tools for people to use (like Naftoli's bind-o-matic thing) is great. Give people a choice and let them use what's best for them. 3) Spend more time trying to be inventive. Anyone have any thoughts? - Josh -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Best way to write a wizard
On Mon, Sep 14, 2009 at 1:12 PM, Josh Suereth joshua.suer...@gmail.comwrote: On Mon, Sep 14, 2009 at 2:31 PM, David Pollak feeder.of.the.be...@gmail.com wrote: On Sun, Sep 13, 2009 at 10:52 AM, Josh Suereth joshua.suer...@gmail.comwrote: All, I write to you (unfortunately still) as a lift n00b. I'm trying to modify a form such that it looks more wizard like. i.e. I want it to specifically state You've completed part 1, you're on step 2 of 5, etc. How should I accomplish this in view-first rendering? Normal MVC, I'd make one controll that redirects you to the appropriate wizard screen depending on what steps have already been accomplished (i.e. the controller figures out which step you're on and sends you to the appropraite view. In Lift, I'm thinking I have a few options: 1) Have my stateful snippet actually return the various pages in code. I'm not happy with this, as my view would reside in the controller, but I could git'r'done this way. Not really. You can have the templates for each phase of the wizard be separate files and use TemplateFinder.findAnyTemplate to load the template for the step of the wizard that you're on. This is akin to the controller-first choosing a template. That's a lot better than I was thinking. Are there any samples that use this? http://github.com/dpp/liftweb/commit/8aab3c61e9b10399afcb4d04f3e23b0750b0e00d -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Best way to write a wizard
It just seems to me that you can already do what you detailed using chooseTemplate? My concern about having multiple ways to do a single task IMHO makes it more confusing for n00bs... Much better if there is a clear problem:solution relationship :-) we already have chooseTemplate right? About wizard, you are right that is what dpp said - however, it's been my experience of dave that if the comunity is discussing soemthing and it keeps comming up (like the wizard) then he generally rolls his sleeves up and gets the job done somehow! Cheers, Tim Sent from my iPhone On 13 Sep 2009, at 21:35, Naftoli Gugenheim naftoli...@gmail.com wrote: What do you mean mixed messages? Do you object to committing bindSwitch--after all it's much more general and basic than wizards--or that it's what Josh should use? Also, I read that DPP said it would take him 2-3 days once he found 2-3 days free to apply himself to lift-wizard. Did I miss a message where he said that he found the time already? - Timothy Perretttimo...@getintheloop.eu wrote: Naftoli, Whilst I commend your idea of bindSwitch, im really not sure that is the right way forward and would only confuse people (we dont want mixed messages). DPP will in two days or less have the wizard in a workable state so i would recommend doing just hanging out until that is completed... by the sounds of it that will provide a much better solution for Josh. Cheers, Tim On 13 Sep 2009, at 20:33, Naftoli Gugenheim wrote: I will try, G-d willing, to commit code today that allows you to bindSwitch -- that is, you give it a list of nodes, one of which is bound; and the others are replaced with NodeSeq.Empty. I used it in a view that had several parts that depend on the state. E.g., if you have not selected a client you see a search box with a button that either chooses a client if there's 1 result, or taked you to a search page. Once a client is selected, you see the clients info with a hyperlink to edit his info, and a button to unselect the client. So you could also use it for wizards. But there's also lift-wizard, which is a work in progress and may be more than what you need; I haven't looked at it myself. But my understanding is that there are usable pieces, it just needs to be polished and tied together. - Josh Suerethjoshua.suer...@gmail.com wrote: All, I write to you (unfortunately still) as a lift n00b. I'm trying to modify a form such that it looks more wizard like. i.e. I want it to specifically state You've completed part 1, you're on step 2 of 5, etc. How should I accomplish this in view-first rendering? Normal MVC, I'd make one controll that redirects you to the appropriate wizard screen depending on what steps have already been accomplished (i.e. the controller figures out which step you're on and sends you to the appropraite view. In Lift, I'm thinking I have a few options: 1) Have my stateful snippet actually return the various pages in code. I'm not happy with this, as my view would reside in the controller, but I could git'r'done this way. 2) Attempt to learn the lift-wizard library (is this stable/ released?) 3) Spend more time trying to be inventive. Anyone have any thoughts? - Josh --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Best way to write a wizard
Well, you could do it with bind too, or just write your own xml recursion. :) With chooseTemplate, you (1) need to have a specific location in the xml that you're binding the results of chooseTemplate to, i.e., the BindParam that holds the chosen part of the view. (2) The part of the view selected with chooseTemplate is contextless -- there's no particular place in the view it belongs. (3) Whichever template is not being used has to be replaced with NodeSeq.Empty. Now these issues are solved if you put the alternatives inside the node that's being used in bind, but what if you accidentally include another xml element with the same prefix/label somewhere else? I'm not saying there isn't a place for chooseTemplate, but for this usage, to me it seems much cleaner using an inline switch. For a two-way switch you need 2 nodes, not 3, and they go in the right place in the view. If I'm not being clear I'll try to post illustrational examples later. As to confusing newbies looking through the code, as per David's suggestion it will go into a separate object, which I called BindPlus (any other suggestion for a name?), which also will have an implicit allowing you to call the bind methods on a NodeSeq, allowing one to chain bind calls (useful for multiple prefixes nested binding like binding a name inside a link). The idea is that all sorts of binding extras can go there. I obviously have no problem with Josh using lift-wizard if it's good enough now or in two days, as was pretty clear from my original message! But his main concern seemed to be switching the view, so I mentioned this option as well. - Timothy Perretttimo...@getintheloop.eu wrote: It just seems to me that you can already do what you detailed using chooseTemplate? My concern about having multiple ways to do a single task IMHO makes it more confusing for n00bs... Much better if there is a clear problem:solution relationship :-) we already have chooseTemplate right? About wizard, you are right that is what dpp said - however, it's been my experience of dave that if the comunity is discussing soemthing and it keeps comming up (like the wizard) then he generally rolls his sleeves up and gets the job done somehow! Cheers, Tim Sent from my iPhone On 13 Sep 2009, at 21:35, Naftoli Gugenheim naftoli...@gmail.com wrote: What do you mean mixed messages? Do you object to committing bindSwitch--after all it's much more general and basic than wizards--or that it's what Josh should use? Also, I read that DPP said it would take him 2-3 days once he found 2-3 days free to apply himself to lift-wizard. Did I miss a message where he said that he found the time already? - Timothy Perretttimo...@getintheloop.eu wrote: Naftoli, Whilst I commend your idea of bindSwitch, im really not sure that is the right way forward and would only confuse people (we dont want mixed messages). DPP will in two days or less have the wizard in a workable state so i would recommend doing just hanging out until that is completed... by the sounds of it that will provide a much better solution for Josh. Cheers, Tim On 13 Sep 2009, at 20:33, Naftoli Gugenheim wrote: I will try, G-d willing, to commit code today that allows you to bindSwitch -- that is, you give it a list of nodes, one of which is bound; and the others are replaced with NodeSeq.Empty. I used it in a view that had several parts that depend on the state. E.g., if you have not selected a client you see a search box with a button that either chooses a client if there's 1 result, or taked you to a search page. Once a client is selected, you see the clients info with a hyperlink to edit his info, and a button to unselect the client. So you could also use it for wizards. But there's also lift-wizard, which is a work in progress and may be more than what you need; I haven't looked at it myself. But my understanding is that there are usable pieces, it just needs to be polished and tied together. - Josh Suerethjoshua.suer...@gmail.com wrote: All, I write to you (unfortunately still) as a lift n00b. I'm trying to modify a form such that it looks more wizard like. i.e. I want it to specifically state You've completed part 1, you're on step 2 of 5, etc. How should I accomplish this in view-first rendering? Normal MVC, I'd make one controll that redirects you to the appropriate wizard screen depending on what steps have already been accomplished (i.e. the controller figures out which step you're on and sends you to the appropraite view. In Lift, I'm thinking I have a few options: 1) Have my stateful snippet actually return the various pages in code. I'm not happy with this, as my view would reside in the controller, but I could git'r'done this way. 2) Attempt to learn the lift-wizard library (is this stable/
[Lift] Re: Best way to write a wizard
Okay, here's what I mean. Using chooseTemplate: View: ... person:code / person:info personinfo:concise person:fullname / bM:/b person:mobile /br / /personinfo:concise personinfo:detailed Last: person:last /br / First: person:first /br / ... /personinfo:detailed /person:info Snippet: bind(person, xhtml, code - person.code.is, info - ( if(!detailedView) bind(person, chooseTemplate(xhtml, personinfo, concise), ...) // did I get the parameter order right? :) else bind(person, chooseTemplate(xhtml, personinfo, detailed), ...) ) ... ) Using bindSwitch, with the implicit enabling bind chaining: View: person:code / personinfo:concise person:fullname / bM:/b person:mobile /br / /personinfo:concise personinfo:detailed Last: person:last /br / First: person:first /br / ... /personinfo:detailed Snippet: def bindDetailed: NodeSeq=NodeSeq = (ns: NodeSeq) = { ... } xhtml.bind(person, code - person.code.is ).bindSwitch(personinfo, Seq(concise, detailed)) ( if(detailedView) 1 - bindDetailed else 0 - {(ns: NodeSeq) = ns.bind(person, fullname - person.calcFullname(), ...)} ) On Sun, Sep 13, 2009 at 5:46 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: By the way, I would be curious to see a link to a post where a newbie was confused by multiple ways to do something -- not curious about the difference, but having a harder time with even one than if there hadn't been the alternative. I'm not doubting what you said--just curious to see such a post. - Timothy Perretttimo...@getintheloop.eu wrote: It just seems to me that you can already do what you detailed using chooseTemplate? My concern about having multiple ways to do a single task IMHO makes it more confusing for n00bs... Much better if there is a clear problem:solution relationship :-) we already have chooseTemplate right? About wizard, you are right that is what dpp said - however, it's been my experience of dave that if the comunity is discussing soemthing and it keeps comming up (like the wizard) then he generally rolls his sleeves up and gets the job done somehow! Cheers, Tim Sent from my iPhone On 13 Sep 2009, at 21:35, Naftoli Gugenheim naftoli...@gmail.com wrote: What do you mean mixed messages? Do you object to committing bindSwitch--after all it's much more general and basic than wizards--or that it's what Josh should use? Also, I read that DPP said it would take him 2-3 days once he found 2-3 days free to apply himself to lift-wizard. Did I miss a message where he said that he found the time already? - Timothy Perretttimo...@getintheloop.eu wrote: Naftoli, Whilst I commend your idea of bindSwitch, im really not sure that is the right way forward and would only confuse people (we dont want mixed messages). DPP will in two days or less have the wizard in a workable state so i would recommend doing just hanging out until that is completed... by the sounds of it that will provide a much better solution for Josh. Cheers, Tim On 13 Sep 2009, at 20:33, Naftoli Gugenheim wrote: I will try, G-d willing, to commit code today that allows you to bindSwitch -- that is, you give it a list of nodes, one of which is bound; and the others are replaced with NodeSeq.Empty. I used it in a view that had several parts that depend on the state. E.g., if you have not selected a client you see a search box with a button that either chooses a client if there's 1 result, or taked you to a search page. Once a client is selected, you see the clients info with a hyperlink to edit his info, and a button to unselect the client. So you could also use it for wizards. But there's also lift-wizard, which is a work in progress and may be more than what you need; I haven't looked at it myself. But my understanding is that there are usable pieces, it just needs to be polished and tied together. - Josh Suerethjoshua.suer...@gmail.com wrote: All, I write to you (unfortunately still) as a lift n00b. I'm trying to modify a form such that it looks more wizard like. i.e. I want it to specifically state You've completed part 1, you're on step 2 of 5, etc. How should I accomplish this in view-first rendering? Normal MVC, I'd make one controll that redirects you to the appropriate wizard screen depending on what steps have already been accomplished (i.e. the controller figures out which step you're on and sends you to the appropraite view. In Lift, I'm thinking I have a few options: 1) Have my stateful snippet actually return the various pages in code. I'm not happy with this, as my view would reside in the controller, but I could git'r'done this way. 2) Attempt to learn the lift-wizard library (is this stable/ released?) 3) Spend more time