I''ve got an image link that''s currently using link_to_remote.
The link calls a method that creates a file and completes with render :nothing
=> true. I''m using the :loading and :complete callbacks on
link_to_remote. On :loading I call a function that renders a
''disabled'' image while the file''s being created.
When the method completes, I use the :complete callback to call another function
that opens a popup containing the file that got created and then renders the
original ''enabled'' image.
The above works fine except for one thing. AFAIK, because it''s being
loaded by as opposed to being sent to the browser, the file that gets rendered
in the popup has to exist in the ''public'' (or some other
externally visible) directory. I need the file to _not_ be visible externally.
The first solution I tried was to eliminate the popup (too many folks have
popups disabled anyway) and change the ''render :nothing =>
true'' to a ''send_file''. That sends the file to the
browser (I can see the file content in Firebug) but, I guess since the browser
is expecting a JS response, it doesn''t do anything with it. Anybody
know a way to send a file using RJS so I can get the ''view or
save'' dialog box?
The second solution I tried was to change the link_to_remote to link_to. That
lets me send the file from a non-externally-visible location, which solves that
problem, but AFAIK link_to doesn''t support the callbacks. I guess I
could use the :onclick to trigger rendering the ''disabled''
image, but can''t figure out how I''d be able to change back to
the ''enabled'' image once the file was received. Any thoughts
on how I could make this work?
Any thoughts on other approaches I might try would be greatly appreciated.
Like, is there maybe some way to use routes to have the
window.open(''title'', ''location/filename'')
being executed in the browser to open the popup and retrieve the file be
intercepted by Rails and mapped to a hidden location?
Thanks,
Bill
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---