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 <netv...@gmail.com> 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 <n...@nu-ex.com> 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