开发者

why is link generated in YUI javascript failing to render in rails?

Using YAHOO.widget.treeview to generate a table with three levels of data: module, submodule, and detail. If there is an image associated with a detail row the javascript generates a link:

"<td><a href=\"/screenshot/show/" + rowData.id + "\">Screenshot</a></td>"

that is appended to the html for the row.

The url is generated correctly and the link appears. When clicked nothing happens except the word 'Done' appears in the browser status bar.

Am calling the very same url from another page that does not use javascript and the screenshot page 开发者_运维知识库appears as expected.

Here is the controller.

class ScreenshotController < ApplicationController

def show if @detail.screen_path.length > 1 @imagePath = "#{RAILS_ROOT}" + "/private/#{Company.find(@detail.company_id).subdir}/" + "#{Project.find(@detail.project_id).subdir}/screenshot/" + "#{@detail.screen_path}" send_file ( @imagePath, :type => 'image/jpeg', :disposition => 'inline') end

end end

A sample url: http://localhost:3004/screenshot/show/20854

This code from show.html.erb belonging to the detail model works:

View', :controller => 'screenshot', :id => @detail.id, :action => 'show' %>

Any ideas???


maybe there's some unwanted js that intercepts your click on generated links?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜