diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-10 10:30:59 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2017-06-10 10:30:59 +0000 |
commit | 8a3c24762d91ecaea4d55734173da6b9fa7aa3ea (patch) | |
tree | 992648bfeb905b64ce20e24fbf31a33dd4e5e1ea /app/models/attachment.rb | |
parent | 30ff1ac451ab9e4eeb4612cd4f3a340f2c5ae7ad (diff) | |
download | redmine-8a3c24762d91ecaea4d55734173da6b9fa7aa3ea.tar.gz redmine-8a3c24762d91ecaea4d55734173da6b9fa7aa3ea.zip |
Preview files by default instead of downloading them (#25988).
Patch by Jan Schulz-Hofen.
git-svn-id: http://svn.redmine.org/redmine/trunk@16651 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r-- | app/models/attachment.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 89b9f8a7c..e2bc570e2 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -31,7 +31,7 @@ class Attachment < ActiveRecord::Base attr_protected :id acts_as_event :title => :filename, - :url => Proc.new {|o| {:controller => 'attachments', :action => 'download', :id => o.id, :filename => o.filename}} + :url => Proc.new {|o| {:controller => 'attachments', :action => 'show', :id => o.id, :filename => o.filename}} acts_as_activity_provider :type => 'files', :permission => :view_files, @@ -251,6 +251,10 @@ class Attachment < ActiveRecord::Base Redmine::MimeType.of(filename) == "application/pdf" end + def previewable? + is_text? || is_image? + end + # Returns true if the file is readable def readable? disk_filename.present? && File.readable?(diskfile) |