bluescreen303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2007-Oct-09 23:37 UTC
cloning elements
Hi, I will have to start on a fully-ajax project soon. To make it easier to split off design to a design-team I want to try an approach similar to the following: The design team creates a single html document for the entire application. This document contains all elements that are needed for the application. Initially all elements are hidden and all "fields" are blank. for example: <div class="person"> <span class="first_name"></span> <span class="last_name"></span> </div> Then when I need to display a person object(that I got using json) somewhere, I would like to be able to make a copy of this element, and apply a behavior to it using lowpro. The behavior will then fill in the fields using the properties of the person object. How can I clone an element (like the person class div in my example) ? Does this seem like a good approach? Thanks for any comments. Mathijs --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 10 Oct 2007, at 01:37, bluescreen303-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> I will have to start on a fully-ajax project soon. > To make it easier to split off design to a design-team I want to try > an approach similar to the following: > > The design team creates a single html document for the entire > application. > This document contains all elements that are needed for the > application. > Initially all elements are hidden and all "fields" are blank. > for example: > > <div class="person"> > <span class="first_name"></span> > <span class="last_name"></span> > </div> > > Then when I need to display a person object(that I got using json) > somewhere, I would like to be able to make a copy of this element, and > apply a behavior to it using lowpro. The behavior will then fill in > the fields using the properties of the person object. > > How can I clone an element (like the person class div in my example) ? > > Does this seem like a good approach?Use Prototype''s Template functions instead: http:// www.prototypejs.org/api/template Inject those in the page as needed instead of trying to clone existing elements. Do watch out for the drawbacks of a fully ajax application (i.e. no bookmarks, no back button, unless you use a state manager). Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 10, 4:21 pm, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> On 10 Oct 2007, at 01:37, bluescreen...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:[...]> Use Prototype''s Template functions instead: http://www.prototypejs.org/api/templateThe example may need some work: // -> Multiply by 1024 to convert from megabytes to gigabytes. :-) -- Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---