@@ -52,8 +52,8 class DocumentsController < ApplicationController | |||||
52 |
|
52 | |||
53 | def create |
|
53 | def create | |
54 | @document = @project.documents.build(params[:document]) |
|
54 | @document = @project.documents.build(params[:document]) | |
55 | if request.post? and @document.save |
|
55 | @document.save_attachments(params[:attachments]) | |
56 | attachments = Attachment.attach_files(@document, params[:attachments]) |
|
56 | if @document.save | |
57 | render_attachment_warning_if_needed(@document) |
|
57 | render_attachment_warning_if_needed(@document) | |
58 | flash[:notice] = l(:notice_successful_create) |
|
58 | flash[:notice] = l(:notice_successful_create) | |
59 | redirect_to :action => 'index', :project_id => @project |
|
59 | redirect_to :action => 'index', :project_id => @project |
@@ -10,6 +10,6 | |||||
10 |
|
10 | |||
11 | <% if @document.new_record? %> |
|
11 | <% if @document.new_record? %> | |
12 | <div class="box tabular"> |
|
12 | <div class="box tabular"> | |
13 | <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form' %></p> |
|
13 | <p><label><%=l(:label_attachment_plural)%></label><%= render :partial => 'attachments/form', :locals => {:container => @document} %></p> | |
14 | </div> |
|
14 | </div> | |
15 | <% end %> |
|
15 | <% end %> |
General Comments 0
You need to be logged in to leave comments.
Login now