jezari designs
2006-Feb-15 02:01 UTC
[Rails] Liquid - form helpers? multiple liquid templates?
Hi, Its taking me a long time to get my head around the Liquid plugin. I have a couple of questions which hopefully someone can help me with... - How difficult would it be to add some kind of Filter or Tag which would allow other Liquid templates to be included into the current Liquid template (eg. similar to render(:file => "filename") - How difficult would it be to add Filters to provide the usual form helper functionality? Thanks, Estelle.
Roberto Saccon
2006-Feb-15 03:06 UTC
[Rails] Liquid - form helpers? multiple liquid templates?
Checkout the source of technoweenie''s mephisto, AFAIK you find there examples for both of your questions http://techno-weenie.net/svn/projects/mephisto/ On 2/14/06, jezari designs <jezari@gmail.com> wrote:> > Hi, > > Its taking me a long time to get my head around the Liquid plugin. I > have a couple of questions which hopefully someone can help me with... > > - How difficult would it be to add some kind of Filter or Tag which > would allow other Liquid templates to be included into the current > Liquid template (eg. similar to render(:file => "filename") > > - How difficult would it be to add Filters to provide the usual form > helper functionality? > > Thanks, > Estelle. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Roberto Saccon - http://rsaccon.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060215/3beaf355/attachment.html
Kris Leech
2006-Feb-17 11:00 UTC
[Rails] Re: Liquid - form helpers? multiple liquid templates?
Hi Estelle, I am working on a similar problem, if you would like to swap notes let me know. -- Posted via http://www.ruby-forum.com/.
Nathaniel S. H. Brown
2006-Feb-17 12:27 UTC
[Rails] Re: Liquid - form helpers? multiple liquid templates?
I wouldn''t mind seeing your notes too? :) Why not share the notes with everyone! -Nb ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Nathaniel S. H. Brown http://nshb.net ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~> -----Original Message----- > From: rails-bounces@lists.rubyonrails.org > [mailto:rails-bounces@lists.rubyonrails.org] On Behalf Of Kris Leech > Sent: February 17, 2006 3:00 AM > To: rails@lists.rubyonrails.org > Subject: [Rails] Re: Liquid - form helpers? multiple liquid templates? > > Hi Estelle, I am working on a similar problem, if you would > like to swap notes let me know. > > > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Kris Leech
2006-Feb-17 14:11 UTC
[Rails] RE: Re: Liquid - form helpers? multiple liquid templates?
Of course! But I have no notes yet... Sometimes you dont wanna hastle the list with lots of little questions and just working with someone else is easier until you have some good info to pass on :) Nathaniel Brown wrote:> I wouldn''t mind seeing your notes too? :) > > Why not share the notes with everyone! > > -Nb > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Nathaniel S. H. Brown http://nshb.net > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-- Posted via http://www.ruby-forum.com/.
Tobias Luetke
2006-Feb-17 16:33 UTC
[Rails] Liquid - form helpers? multiple liquid templates?
> Its taking me a long time to get my head around the Liquid plugin. I > have a couple of questions which hopefully someone can help me with...Thanks for checking it out.> - How difficult would it be to add some kind of Filter or Tag which > would allow other Liquid templates to be included into the current > Liquid template (eg. similar to render(:file => "filename")I have been toying with the idea of allowing includes in a similar way rail''s partials work. The issue here is the scope. Liquid is meant for to be used in very specific areas where you want to allow your users to change the appearance of aspects of your web application. Allowing includes of any kind would have to happen through a highly managed and restricted interface. Additionally not all people who use liquid render the templates from the file system. You can just as well render templates from the DB. Where would it look for the included files in this case: DB or FS?> > - How difficult would it be to add Filters to provide the usual form > helper functionality?Filters and helpers are similar things but not quite the same. Filters only act on data which is passed to them, they cannot be called stand alone in the current liquid implementation. This is a limitation which liquid inherited from django templates. I''m not terribly happy with myself. It works quite well but If you approach, as most people do, with a rails background it seems backwards. In shopify we use filters like this: {{ product.url | link_to: ''Cool Product'' }} #=> <a href="/products/cool-product" title="Cool Product>Cool Product</a> {{ product.feature_image | product_image: ''small'' }} {{ ''shop.css'' | assets_url | stylesheet_link_tag }} {{ ''shop.js'' | assets_url | javascript_source_tag }} You always start with the core information on the left and run it through filters to get the desired result.> Thanks, > Estelle. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://shopify.com - modern e-commerce software http://typo.leetsoft.com - Open source weblog engine http://blog.leetsoft.com - Technical weblog
jezari designs
2006-Feb-17 21:36 UTC
[Rails] Liquid - form helpers? multiple liquid templates?
Tobias - Thanks for the info! I haven''t decided whether I want to store templates in the database or filesystem. I was leaning towards filesystem, but if the database is easier then I can probably do that instead. The main thing is that I need to be able to include multiple template files into one larger file, similar to how the rhtml layout files work. Liquid templates look fantastic for my purposes, but without this functionality I can''t possibly use Liquid templates. Could you offer any suggestions as to how I could have one master layout page (ideally Liquid, but possibly could be rhtml instead) and include multiple Liquid templates to form the final page? (This is probably easy, but I''m still a newbie!) I also couldn''t figure out how to define my own Filters (when using Liquid templates in the filesystem in place of rhtml files). I was using the info in the Liquid wiki, but I still couldn''t get it to work. But, I''m sure this can''t be hard so I''ll just have another look into it. (On a side note, I think the installation of Globalize may have caused Liquid templates to no longer work, or vice versa... yay) Kris - contact me anytime, but there''s a few other things I need to work on first so it may be some time before I''ve made any progress with incorporating Liquid templates into my app. If I figure anything out i''ll be sure to let you guys know :)
Tobias Luetke
2006-Feb-17 22:17 UTC
[Rails] Liquid - form helpers? multiple liquid templates?
On 2/17/06, jezari designs <jezari@gmail.com> wrote:> Tobias - Thanks for the info! > > I haven''t decided whether I want to store templates in the database or > filesystem. I was leaning towards filesystem, but if the database is > easier then I can probably do that instead. > > The main thing is that I need to be able to include multiple template > files into one larger file, similar to how the rhtml layout files > work. Liquid templates look fantastic for my purposes, but without > this functionality I can''t possibly use Liquid templates. Could you > offer any suggestions as to how I could have one master layout page > (ideally Liquid, but possibly could be rhtml instead) and include > multiple Liquid templates to form the final page? (This is probably > easy, but I''m still a newbie!)Currently you can use liquid for layouts just like you can rhtml. Maybe thats what you need?> > I also couldn''t figure out how to define my own Filters (when using > Liquid templates in the filesystem in place of rhtml files). I was > using the info in the Liquid wiki, but I still couldn''t get it to > work. But, I''m sure this can''t be hard so I''ll just have another look > into it. (On a side note, I think the installation of Globalize may > have caused Liquid templates to no longer work, or vice versa... yay)You can create filters in your helpers file. In the first parameter of the methods you will get the string representation of the left side of the filter.> > Kris - contact me anytime, but there''s a few other things I need to > work on first so it may be some time before I''ve made any progress > with incorporating Liquid templates into my app. If I figure anything > out i''ll be sure to let you guys know :) > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Tobi http://shopify.com - modern e-commerce software http://typo.leetsoft.com - Open source weblog engine http://blog.leetsoft.com - Technical weblog
Make application.liquid and put {{ content_for_layout }} somewhere in it and it will insert the liquid view in the layout just like normal rthml''s. K -- Posted via http://www.ruby-forum.com/.
Kris Leech
2006-Feb-18 18:37 UTC
[Rails] Re: Liquid - form helpers? multiple liquid templates?
"I have been toying with the idea of allowing includes in a similar way rail''s partials work." This would be good. I think the ability to use components would be even better so you can call an action and get the results as liquid code - a good example being getting a menu for the currently logged in user. -- Posted via http://www.ruby-forum.com/.