summaryrefslogtreecommitdiffstats
path: root/app/helpers/attachments_helper.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-18 20:53:10 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-18 20:53:10 +0000
commitf89483a206b4aea3a307000c5ed7c0e9da5bea93 (patch)
tree060d0e9b017fb58474b1c4bd5c8c5554ef5578a3 /app/helpers/attachments_helper.rb
parente10198f0d5f3f0b7ba2f95a1fa1ae16abe89fb0d (diff)
downloadredmine-f89483a206b4aea3a307000c5ed7c0e9da5bea93.tar.gz
redmine-f89483a206b4aea3a307000c5ed7c0e9da5bea93.zip
REST API for reading attachments (#7671).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6295 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/helpers/attachments_helper.rb')
-rw-r--r--app/helpers/attachments_helper.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/helpers/attachments_helper.rb b/app/helpers/attachments_helper.rb
index e6150a3b3..f7e4d8420 100644
--- a/app/helpers/attachments_helper.rb
+++ b/app/helpers/attachments_helper.rb
@@ -43,4 +43,17 @@ module AttachmentsHelper
str
end
end
+
+ def render_api_attachment(attachment, api)
+ api.attachment do
+ api.id attachment.id
+ api.filename attachment.filename
+ api.filesize attachment.filesize
+ api.content_type attachment.content_type
+ api.description attachment.description
+ api.content_url url_for(:controller => 'attachments', :action => 'download', :id => attachment, :filename => attachment.filename, :only_path => false)
+ api.author(:id => attachment.author.id, :name => attachment.author.name) if attachment.author
+ api.created_on attachment.created_on
+ end
+ end
end