Listing and managing attachments
Redmine provides a view partial for listing the existing attachments on a model as well. In order to quickly implement this functionality, the /path/to/redmine/app/views/attachments/_links.html.erb
partial can be plugged into any view and passed a collection of attachments as follows:
<%= render :partial => 'attachments/links', :locals => { :attachments => @article.attachments, :options => { :deletable => User.current.logged? } } %>
This will change the view as shown in the following screenshot:
In addition to the attachments collection that is required, the links
partial also accepts an options
hash. This hash only accepts the following keys:
:author
: If the value evaluates to true, the attachment author is listed along with the timestamp of when the attachment was created:deletable
: If the value evaluates to true, a delete link will be rendered, which allows the current user the ability to permanently remove the attachment...