Micah, Feel free to rip the controller code from the page_preview extension that I wrote for the facets branch. The code is here:
http://dev.radiantcms.org/radiant/browser/branches/facets/extensions/page_preview/lib/preview_controller_extensions.rb This module is included into the admin/page controller, giving it a "preview" action. Essentially it wraps the creating and updating of associated page-parts in a transaction, then raises an exception so the transaction rolls back. However, the render has happened already inside the transaction, so you get the page as it would look on the site. Enjoy! Sean Micah Wylde wrote: > Hi, everyone. I'm new to Radiant, developing my first Radiant-powered site. > I've developed a preview extension, which injects via javascript a preview > link into the page editor, which when clicked hides the textbox and shows a > div filled with the preview (obtained through Ajax.Updater). To accomplish > this, I have a controller method which takes the raw text from the textbox > and returns rendered html. My problem is, while my method works fine for > built-in radius tags, it does not work for radius tags defined in > extensions. My code is below. > def filter_text(filter, text, slug) > filterClass = nil > eval("filterClass = #{filter}Filter") > filter = filterClass.new > filteredText = filter.filter(text) > page = Page.find(:first, :conditions => ["slug = ?", slug]) > context = PageContext.new(page) > parser = Radius::Parser.new(context, :tag_prefix => 'r') > begin > return parser.parse(filteredText); > rescue > return filteredText > end > end > > I admit that I don't really have much of an idea of what I'm doing here. > I've been looking through the code of Radiant trying to figure out how it > does it, but I've been unable to find the place where it actually does the > rendering (I assume it's somewhere in the Page model, but the only radius > code I've been able to find there I've replicated above). Any help would be > greatly appreciated. > > _______________________________________________ Radiant mailing list Post: [email protected] Search: http://radiantcms.org/mailing-list/search/ Site: http://lists.radiantcms.org/mailman/listinfo/radiant
