From apotonick at gmail.com Mon Jun 8 17:05:07 2009 From: apotonick at gmail.com (Nick Sutterer) Date: Mon, 8 Jun 2009 23:05:07 +0200 Subject: [Cells-talk] RFC: introducing a #render method in Cells? Message-ID: hey you guys out there, this list is very low-traffic ATM, i hope this means cells is as stable as you expect it to be and the docs do not leave a single question unanswered ;-) i was thinking about introducing a new method #render which can be called in cell states. providing no arguments as def my_state # ... do something render end would just expose the same behaviour as returning nil. however, it would accept the following options: def another_state # ... do something meaningful render :layout => 'metal', :template_format => :html, :view => 'another_view' end providing support for - layouts for cells - a template format different to "html" (not possible currently) - rendering a freely choosable view from the cell, not being tied to the state name i'd love to hear your feedback, just briefly - is this confusing- having a #render method with a DIFFERENT api than ActionController#render ? - if yes, what could the method name be? - did you already miss one or more these new features in the current version? - would you expect #render to render a :partial as well? (that wouldn't make any sense at all, would it?) thanks and cheers, nick From michal.lomnicki at gmail.com Fri Jun 12 07:33:04 2009 From: michal.lomnicki at gmail.com (=?UTF-8?Q?Micha=C5=82_=C5=81omnicki?=) Date: Fri, 12 Jun 2009 13:33:04 +0200 Subject: [Cells-talk] RFC: introducing a #render method in Cells? In-Reply-To: References: Message-ID: <1244806384.15303.19.camel@wyjec> > i was thinking about introducing a new method #render which can be > called in cell states. > providing no arguments as > > def my_state > # ... do something > > render > end That is definitely good idea. Calling render should be much more descriptive than returning nil. > however, it would accept the following options: > > def another_state > # ... do something meaningful > > render :layout => 'metal', > :template_format => :html, > :view => 'another_view' > end Why not to introduce well-known rails render method, something like render :action => 'another_view', :layout => 'metal' render :text => "OK" render :js => "alert('hello cells')" and render without arguments should be equivalent to render :action => 'my_state' > - is this confusing- having a #render method with a DIFFERENT api than > ActionController#render ? It could be confusing in my opinion and the simplest solution is to provide the same "render" api :) > - did you already miss one or more these new features in the current version? We should think about new parameters passing style. Currently we pass params by @opts hash, what do you think about: view: render_cell :my_cell, :my_state, param1, param2 cell: def my_state( param1, param2 ) ... end it should be more obvious than accessing @opts, shouldn't it? > - would you expect #render to render a :partial as well? (that > wouldn't make any sense at all, would it?) I think that it would be useless, just can't imagine situation when rendering partial from cell is needed. Regards -- Micha? ?omnicki From apotonick at gmail.com Thu Jun 18 06:48:49 2009 From: apotonick at gmail.com (Nick Sutterer) Date: Thu, 18 Jun 2009 12:48:49 +0200 Subject: [Cells-talk] RFC: introducing a #render method in Cells? In-Reply-To: <1244806384.15303.19.camel@wyjec> References: <1244806384.15303.19.camel@wyjec> Message-ID: hey all, hey micha?, thanks for your feedback! i prototyped a #render method in cells, it's available at http://github.com/apotonick/cells/commit/7ccbcdaa44a35a666e43219a2c7e667c1c0267f8 and provides new behaviour for cells. let me just quote the commit message: ------------------------ introduced #render which is a replacement for the old-style "returning nil" convention at the end of a state method. this method receives the following options (more to come!): :view specifies the view name to render (defaults to state name) :template_format specifies an alternative format to :html :layout if present, the state content will be embedded in a cell layout note that the old-style API in a state method still works (returning nil or a string). ------------------------ i'm really asking you for feedback. what's still missing? which parameter should be renamed? > and render without arguments should be equivalent to > render :action => 'my_state' > i really don't like the word "action", since it implies execution AND rendering an action/a state for me. so i decided to call it #render :view => ... - am i wrong with this? thanks for any feedback, cheers, nick