views:

304

answers:

1

Hi All,

I'm trying to render .odf files from a controller action in a rails application. I'd like to be able to put templates inside my view folders called show.odp.erb, show.odf.erb, etc.. and have that represent the content.xml file that is inside the zip. I'd also like to be able to render these actions in the controller like so:

respond_to do |format|
  format.odf {
    #odf code here
  }
  format.odp {
    #probably about the same as the odf code, but renders a different template with a different file extension.
  }

I would also like to have a template content.xml file in my layouts directory that has the necessary headers and footers. The main questions I have are these:

should I put all .odf files in one folder in the layouts directory? or should i put the static ones in the public directory?

how can i insert the dynamic content.xml file into the directory before I zip it up and serve it? I hope this is an easy enough question for a render guru out there ;)

thx

-C

+1  A: 

this was not easy. I wound up writing a module, that essentially pulls templates from a directory, applies a layout, zips up the whole package and serves it up. details are included with the module, as it's a bit too complicated to explain here, but it can be found at this pastebin link

hope this helps someone else

-C

Chris Drappier