comparison app/helpers/attachments_helper.rb @ 1115:433d4f72a19b redmine-2.2

Update to Redmine SVN revision 11137 on 2.2-stable branch
author Chris Cannam
date Mon, 07 Jan 2013 12:01:42 +0000
parents cbb26bc654de
children bb32da3bea34 622f24f53b42
comparison
equal deleted inserted replaced
929:5f33065ddc4b 1115:433d4f72a19b
1 # encoding: utf-8 1 # encoding: utf-8
2 # 2 #
3 # Redmine - project management software 3 # Redmine - project management software
4 # Copyright (C) 2006-2011 Jean-Philippe Lang 4 # Copyright (C) 2006-2012 Jean-Philippe Lang
5 # 5 #
6 # This program is free software; you can redistribute it and/or 6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License 7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2 8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version. 9 # of the License, or (at your option) any later version.
19 19
20 module AttachmentsHelper 20 module AttachmentsHelper
21 # Displays view/delete links to the attachments of the given object 21 # Displays view/delete links to the attachments of the given object
22 # Options: 22 # Options:
23 # :author -- author names are not displayed if set to false 23 # :author -- author names are not displayed if set to false
24 # :thumbails -- display thumbnails if enabled in settings
24 def link_to_attachments(container, options = {}) 25 def link_to_attachments(container, options = {})
25 options.assert_valid_keys(:author) 26 options.assert_valid_keys(:author, :thumbnails)
26 27
27 if container.attachments.any? 28 if container.attachments.any?
28 options = {:deletable => container.attachments_deletable?, :author => true}.merge(options) 29 options = {:deletable => container.attachments_deletable?, :author => true}.merge(options)
29 render :partial => 'attachments/links', :locals => {:attachments => container.attachments, :options => options} 30 render :partial => 'attachments/links',
31 :locals => {:attachments => container.attachments, :options => options, :thumbnails => (options[:thumbnails] && Setting.thumbnails_enabled?)}
30 end 32 end
31 end 33 end
32 34
33 def render_api_attachment(attachment, api) 35 def render_api_attachment(attachment, api)
34 api.attachment do 36 api.attachment do