Enabling attachments in our views
Adding multiple file attachment capabilities to our article creation and update form is also simple and straightforward. To make our implementation even easier, Redmine already has a styled and structured sample available in the issue management code that we can reuse.
The following code snippet needs to be copied and pasted into the form (or form partial) that we're using to create and edit articles. Assuming we're using the standard Rails method of building forms using FormBuilder
(visit http://api.rubyonrails.org/classes/ActionView/Helpers/FormBuilder.html), the following code would need to be inserted within a view's form_for
block:
<div class="box"> <p> <label><%=l(:label_attachment_plural)%></label> <%= render :partial => 'attachments/form' %> </p> </div>
This incorporates the stock Redmine view partial that allows files to be uploaded asynchronously and attached to our model.
The preceding...