summaryrefslogtreecommitdiffstats
path: root/app/models/attachment.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2018-05-17 13:09:43 +0000
committerGo MAEDA <maeda@farend.jp>2018-05-17 13:09:43 +0000
commit37d1fcf8a46d990a6a1c5ffb1a3f943c8130a004 (patch)
treed20a86691101167dd312358d5eb105e1a3cb7e86 /app/models/attachment.rb
parentccfdee4a53dbe828f7a1cf3a5810d1df2fc53fd1 (diff)
downloadredmine-37d1fcf8a46d990a6a1c5ffb1a3f943c8130a004.tar.gz
redmine-37d1fcf8a46d990a6a1c5ffb1a3f943c8130a004.zip
Adds previews for audio / video attachments (#27336).
Patch by Jens Kraemer. git-svn-id: http://svn.redmine.org/redmine/trunk@17340 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r--app/models/attachment.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index b967e5720..47955c0b1 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -250,8 +250,16 @@ class Attachment < ActiveRecord::Base
Redmine::MimeType.of(filename) == "application/pdf"
end
+ def is_video?
+ Redmine::MimeType.is_type?('video', filename)
+ end
+
+ def is_audio?
+ Redmine::MimeType.is_type?('audio', filename)
+ end
+
def previewable?
- is_text? || is_image?
+ is_text? || is_image? || is_video? || is_audio?
end
# Returns true if the file is readable