[Radiant] Re: render_radiant
I c. Thanks for clarifying. Looks useful. Again, thank you for contributing. I added your repo to my watch list on github. On Jan 20, 6:32 pm, nx wrote: > Yeah, so if you had a "photos" controller and you want people to be > able to submit photos through your Radiant site: > > Request -> Action -> Radiant Page Used for Rendering > /photos -> index -> /photos > /photos/29 -> show -> /photos/show > /photos/29/edit -> edit -> /photos/edit > /photos/new -> new -> /photos/new > /photos/recent -> recent -> /photos/recent > > You can change the page to load by passing the :action option, just > like the regular render method. > > On Thu, Jan 20, 2011 at 7:09 PM, Haselwanter Edmund > > wrote: > > > On 20.01.2011, at 23:02, nx wrote: > > >> share_layout, as far as I know (haven't used it), uses templates (ERB, > >> Haml, whatever) rendered from the action and wraps the rendered > >> template in the Radiant layout. > > >> render_radiant, on the other hand, uses a Radiant page matching the > >> path of the /controller/action as the "template" in this context. So > >> you can use Radiant for the entire View part of the extension. > >> render_radiant assigns data from the action to the page's context, so > >> all your Radius tags are rendered with the requested action's state. > > >> I like this method because I'm putting more Controller-like logic back > >> into the controller, instead of hacking Page.process or subclassing > >> Page to get data posted from forms and query params. > > >> Does that clear up the difference any? > > > Love that idea. Must wrap my head around the matching slug vs. route stuff > > but > > that's really useful :-) > > >> On Thu, Jan 20, 2011 at 4:38 PM, swartz wrote: > >>> I gave a very brief look at your extension. > >>> I do not mean to devalue your contribution(in fact, thank you for it), > >>> but isn't this what share_layout extension does? > >>>https://github.com/radiant/radiant-share-layouts-extension > > >>> Also check spanner's fork: > >>>https://github.com/spanner/radiant-share-layouts-extension > > >>> -- > >>> Swartz > > >>> On Jan 19, 9:18 pm, nx wrote: > I wanted to use ActionController like I always have, except render the > action with Radiant. So I wrote a gem that overrides "render" to take > instance variables and methods like "params" and "flash" from the > action and assign them to the page context to be accessible from my > Radius tags. It uses a Radiant page that matches the URL of the > request for rendering. Here's an example from the README: > > EventsController < ActionController::Base > > def index > @events = Event.all > render :radiant > end > > def show > @event = Event.find(params[:id]) > render :radiant, :locals => { :cool_event => @event.cool? } > end > > end > > So a request for "/events/23" will use a Page with the url > "/events/show" and will load tag.locals.event and > tag.locals.cool_event with the values given in the action. > > You can override default page properties by passing them into the main > :radiant option: > > render :radiant => { :title => "Title Override", :breadcrumb => "My > Page" } > > This gem also opens up the possibility of handling different formats, > like: > > respond_to do |format| > format.html { render :radiant } > format.json { render :json } > end > > Just do "gem install render_radiant" and require it in your > extension_config to install. > Github:http://github.com/nuex/render_radiant. > > Thought someone else might be interested in building custom extensions > this way. > > > -- > > DI Edmund Haselwanter, edm...@haselwanter.com,http://edmund.haselwanter.com/ > >http://www.iteh.at|http://facebook.com/iTeh.solutions|http://at.linkedin.com/in/haselwanteredmund > >
Re: [Radiant] Re: render_radiant
Yeah, so if you had a "photos" controller and you want people to be able to submit photos through your Radiant site: Request -> Action -> Radiant Page Used for Rendering /photos -> index -> /photos /photos/29 -> show -> /photos/show /photos/29/edit -> edit -> /photos/edit /photos/new -> new -> /photos/new /photos/recent -> recent -> /photos/recent You can change the page to load by passing the :action option, just like the regular render method. On Thu, Jan 20, 2011 at 7:09 PM, Haselwanter Edmund wrote: > > On 20.01.2011, at 23:02, nx wrote: > >> share_layout, as far as I know (haven't used it), uses templates (ERB, >> Haml, whatever) rendered from the action and wraps the rendered >> template in the Radiant layout. >> >> render_radiant, on the other hand, uses a Radiant page matching the >> path of the /controller/action as the "template" in this context. So >> you can use Radiant for the entire View part of the extension. >> render_radiant assigns data from the action to the page's context, so >> all your Radius tags are rendered with the requested action's state. >> >> I like this method because I'm putting more Controller-like logic back >> into the controller, instead of hacking Page.process or subclassing >> Page to get data posted from forms and query params. >> >> Does that clear up the difference any? > > Love that idea. Must wrap my head around the matching slug vs. route stuff but > that's really useful :-) > >> >> On Thu, Jan 20, 2011 at 4:38 PM, swartz wrote: >>> I gave a very brief look at your extension. >>> I do not mean to devalue your contribution(in fact, thank you for it), >>> but isn't this what share_layout extension does? >>> https://github.com/radiant/radiant-share-layouts-extension >>> >>> Also check spanner's fork: >>> https://github.com/spanner/radiant-share-layouts-extension >>> >>> -- >>> Swartz >>> >>> On Jan 19, 9:18 pm, nx wrote: I wanted to use ActionController like I always have, except render the action with Radiant. So I wrote a gem that overrides "render" to take instance variables and methods like "params" and "flash" from the action and assign them to the page context to be accessible from my Radius tags. It uses a Radiant page that matches the URL of the request for rendering. Here's an example from the README: EventsController < ActionController::Base def index @events = Event.all render :radiant end def show @event = Event.find(params[:id]) render :radiant, :locals => { :cool_event => @event.cool? } end end So a request for "/events/23" will use a Page with the url "/events/show" and will load tag.locals.event and tag.locals.cool_event with the values given in the action. You can override default page properties by passing them into the main :radiant option: render :radiant => { :title => "Title Override", :breadcrumb => "My Page" } This gem also opens up the possibility of handling different formats, like: respond_to do |format| format.html { render :radiant } format.json { render :json } end Just do "gem install render_radiant" and require it in your extension_config to install. Github:http://github.com/nuex/render_radiant. Thought someone else might be interested in building custom extensions this way. >>> > > -- > DI Edmund Haselwanter, edm...@haselwanter.com, http://edmund.haselwanter.com/ > http://www.iteh.at | http://facebook.com/iTeh.solutions | > http://at.linkedin.com/in/haselwanteredmund > > > > > >
Re: [Radiant] Re: render_radiant
On 20.01.2011, at 23:02, nx wrote: > share_layout, as far as I know (haven't used it), uses templates (ERB, > Haml, whatever) rendered from the action and wraps the rendered > template in the Radiant layout. > > render_radiant, on the other hand, uses a Radiant page matching the > path of the /controller/action as the "template" in this context. So > you can use Radiant for the entire View part of the extension. > render_radiant assigns data from the action to the page's context, so > all your Radius tags are rendered with the requested action's state. > > I like this method because I'm putting more Controller-like logic back > into the controller, instead of hacking Page.process or subclassing > Page to get data posted from forms and query params. > > Does that clear up the difference any? Love that idea. Must wrap my head around the matching slug vs. route stuff but that's really useful :-) > > On Thu, Jan 20, 2011 at 4:38 PM, swartz wrote: >> I gave a very brief look at your extension. >> I do not mean to devalue your contribution(in fact, thank you for it), >> but isn't this what share_layout extension does? >> https://github.com/radiant/radiant-share-layouts-extension >> >> Also check spanner's fork: >> https://github.com/spanner/radiant-share-layouts-extension >> >> -- >> Swartz >> >> On Jan 19, 9:18 pm, nx wrote: >>> I wanted to use ActionController like I always have, except render the >>> action with Radiant. So I wrote a gem that overrides "render" to take >>> instance variables and methods like "params" and "flash" from the >>> action and assign them to the page context to be accessible from my >>> Radius tags. It uses a Radiant page that matches the URL of the >>> request for rendering. Here's an example from the README: >>> >>> EventsController < ActionController::Base >>> >>> def index >>> @events = Event.all >>> render :radiant >>> end >>> >>> def show >>> @event = Event.find(params[:id]) >>> render :radiant, :locals => { :cool_event => @event.cool? } >>> end >>> >>> end >>> >>> So a request for "/events/23" will use a Page with the url >>> "/events/show" and will load tag.locals.event and >>> tag.locals.cool_event with the values given in the action. >>> >>> You can override default page properties by passing them into the main >>> :radiant option: >>> >>> render :radiant => { :title => "Title Override", :breadcrumb => "My Page" >>> } >>> >>> This gem also opens up the possibility of handling different formats, like: >>> >>>respond_to do |format| >>> format.html { render :radiant } >>> format.json { render :json } >>>end >>> >>> Just do "gem install render_radiant" and require it in your >>> extension_config to install. Github:http://github.com/nuex/render_radiant. >>> >>> Thought someone else might be interested in building custom extensions this >>> way. >> -- DI Edmund Haselwanter, edm...@haselwanter.com, http://edmund.haselwanter.com/ http://www.iteh.at | http://facebook.com/iTeh.solutions | http://at.linkedin.com/in/haselwanteredmund
Re: [Radiant] Re: render_radiant
share_layout, as far as I know (haven't used it), uses templates (ERB, Haml, whatever) rendered from the action and wraps the rendered template in the Radiant layout. render_radiant, on the other hand, uses a Radiant page matching the path of the /controller/action as the "template" in this context. So you can use Radiant for the entire View part of the extension. render_radiant assigns data from the action to the page's context, so all your Radius tags are rendered with the requested action's state. I like this method because I'm putting more Controller-like logic back into the controller, instead of hacking Page.process or subclassing Page to get data posted from forms and query params. Does that clear up the difference any? On Thu, Jan 20, 2011 at 4:38 PM, swartz wrote: > I gave a very brief look at your extension. > I do not mean to devalue your contribution(in fact, thank you for it), > but isn't this what share_layout extension does? > https://github.com/radiant/radiant-share-layouts-extension > > Also check spanner's fork: > https://github.com/spanner/radiant-share-layouts-extension > > -- > Swartz > > On Jan 19, 9:18 pm, nx wrote: >> I wanted to use ActionController like I always have, except render the >> action with Radiant. So I wrote a gem that overrides "render" to take >> instance variables and methods like "params" and "flash" from the >> action and assign them to the page context to be accessible from my >> Radius tags. It uses a Radiant page that matches the URL of the >> request for rendering. Here's an example from the README: >> >> EventsController < ActionController::Base >> >> def index >> @events = Event.all >> render :radiant >> end >> >> def show >> @event = Event.find(params[:id]) >> render :radiant, :locals => { :cool_event => @event.cool? } >> end >> >> end >> >> So a request for "/events/23" will use a Page with the url >> "/events/show" and will load tag.locals.event and >> tag.locals.cool_event with the values given in the action. >> >> You can override default page properties by passing them into the main >> :radiant option: >> >> render :radiant => { :title => "Title Override", :breadcrumb => "My Page" } >> >> This gem also opens up the possibility of handling different formats, like: >> >> respond_to do |format| >> format.html { render :radiant } >> format.json { render :json } >> end >> >> Just do "gem install render_radiant" and require it in your >> extension_config to install. Github:http://github.com/nuex/render_radiant. >> >> Thought someone else might be interested in building custom extensions this >> way. >
Re: [Radiant] Re: render_radiant
On 20 Jan 2011, at 21:38, swartz wrote: > I gave a very brief look at your extension. > I do not mean to devalue your contribution(in fact, thank you for it), > but isn't this what share_layout extension does? > https://github.com/radiant/radiant-share-layouts-extension > > Also check spanner's fork: > https://github.com/spanner/radiant-share-layouts-extension Ah, yes. That fork is a bit out of date now. I should delete it, really. The most recent work on layouts is Dirk's 'layouts' extension, which includes nested_layouts as well but doesn't show up very well in searches because it's a fork with a different name: https://github.com/squaretalent/radiant-layouts-extension The purpose of my fork was to add ActionMailer support, which is an ugly business but useful. That code has since moved to 'mailer_layouts': https://github.com/spanner/radiant-mailer_layouts-extension and I use it in the reader extensions to make the administrative email a bit nicer. best, will
[Radiant] Re: render_radiant
I gave a very brief look at your extension. I do not mean to devalue your contribution(in fact, thank you for it), but isn't this what share_layout extension does? https://github.com/radiant/radiant-share-layouts-extension Also check spanner's fork: https://github.com/spanner/radiant-share-layouts-extension -- Swartz On Jan 19, 9:18 pm, nx wrote: > I wanted to use ActionController like I always have, except render the > action with Radiant. So I wrote a gem that overrides "render" to take > instance variables and methods like "params" and "flash" from the > action and assign them to the page context to be accessible from my > Radius tags. It uses a Radiant page that matches the URL of the > request for rendering. Here's an example from the README: > > EventsController < ActionController::Base > > def index > @events = Event.all > render :radiant > end > > def show > @event = Event.find(params[:id]) > render :radiant, :locals => { :cool_event => @event.cool? } > end > > end > > So a request for "/events/23" will use a Page with the url > "/events/show" and will load tag.locals.event and > tag.locals.cool_event with the values given in the action. > > You can override default page properties by passing them into the main > :radiant option: > > render :radiant => { :title => "Title Override", :breadcrumb => "My Page" } > > This gem also opens up the possibility of handling different formats, like: > > respond_to do |format| > format.html { render :radiant } > format.json { render :json } > end > > Just do "gem install render_radiant" and require it in your > extension_config to install. Github:http://github.com/nuex/render_radiant. > > Thought someone else might be interested in building custom extensions this > way.