File viewer for attached text files.

git-svn-id: http://redmine.rubyforge.org/svn/trunk@1520 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2008-06-09 18:40:59 +00:00
parent aa0beecad0
commit 80a7486f95
14 changed files with 181 additions and 12 deletions
+7 -4
View File
@@ -23,7 +23,10 @@ class AttachmentsController < ApplicationController
if @attachment.is_diff?
@diff = File.new(@attachment.diskfile, "rb").read
render :action => 'diff'
else
elsif @attachment.is_text?
@content = File.new(@attachment.diskfile, "rb").read
render :action => 'file'
elsif
download
end
end
@@ -38,9 +41,9 @@ class AttachmentsController < ApplicationController
private
def find_project
@attachment = Attachment.find(params[:id])
render_404 and return false unless File.readable?(@attachment.diskfile)
#render_404 and return false unless File.readable?(@attachment.diskfile)
@project = @attachment.project
rescue
render_404
#rescue
# render_404
end
end