summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-16 16:42:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-07-16 16:42:23 +0000
commit5c2de4dfc95293a7965ff8cf980a310922fc4c05 (patch)
tree216137d4546e967ca7f4ce7fee328ac62ca93830 /app
parent570e1b1d626543738cec3dc3ed07da73a47a98dd (diff)
downloadredmine-5c2de4dfc95293a7965ff8cf980a310922fc4c05.tar.gz
redmine-5c2de4dfc95293a7965ff8cf980a310922fc4c05.zip
Adds Attachment#title.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10012 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/models/attachment.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb
index 0dda33023..9aeee07d0 100644
--- a/app/models/attachment.rb
+++ b/app/models/attachment.rb
@@ -137,6 +137,14 @@ class Attachment < ActiveRecord::Base
File.join(self.class.storage_path, disk_filename.to_s)
end
+ def title
+ title = filename.to_s
+ if description.present?
+ title << " (#{description})"
+ end
+ title
+ end
+
def increment_download
increment!(:downloads)
end