Mercurial > hg > soundsoftware-site
comparison app/helpers/attachments_helper.rb @ 1339:c03a6c3c4db9 luisf
Merge
author | luisf <luis.figueira@eecs.qmul.ac.uk> |
---|---|
date | Thu, 20 Jun 2013 14:34:42 +0100 |
parents | bb32da3bea34 |
children | 4f746d8966dd |
comparison
equal
deleted
inserted
replaced
1079:413d1d9c3efa | 1339:c03a6c3c4db9 |
---|---|
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 |