diff options
author | Go MAEDA <maeda@farend.jp> | 2019-10-03 00:09:28 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-10-03 00:09:28 +0000 |
commit | 3ce678510e96fa0ce5459e6b7731878347f686b2 (patch) | |
tree | 6d556d89e83137e55f382af2377abd8bda0f61fa /app/models/attachment.rb | |
parent | df1c54146f36e16becb4de7137074238ca496776 (diff) | |
download | redmine-3ce678510e96fa0ce5459e6b7731878347f686b2.tar.gz redmine-3ce678510e96fa0ce5459e6b7731878347f686b2.zip |
Render Textile and Markdown attachments on the preview page (#29752).
Patch by Takenori TAKAKI.
git-svn-id: http://svn.redmine.org/redmine/trunk@18584 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/attachment.rb')
-rw-r--r-- | app/models/attachment.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 29d1acc79..0cd666499 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -240,6 +240,14 @@ class Attachment < ActiveRecord::Base Redmine::MimeType.is_type?('text', filename) || Redmine::SyntaxHighlighting.filename_supported?(filename) end + def is_markdown? + Redmine::MimeType.of(filename) == 'text/markdown' + end + + def is_textile? + self.filename =~ /\.textile$/i + end + def is_image? Redmine::MimeType.is_type?('image', filename) end |