Re: [Radiant] render_radiant
On 20/1/2011 11:18 AM, 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: I'm not yet sure of the details as I read it, but it sounds really cool. Thanks for sharing. Cheers, Mohit. 20/1/2011 | 2:00 PM.
[Radiant] render_radiant
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.