diff --git a/redmine/app/controllers/issues_controller.rb b/redmine/app/controllers/issues_controller.rb index 8bf3805d..d428c75b 100644 --- a/redmine/app/controllers/issues_controller.rb +++ b/redmine/app/controllers/issues_controller.rb @@ -101,12 +101,11 @@ class IssuesController < ApplicationController end def add_attachment - # Save the attachment - if params[:attachment][:file].size > 0 - @attachment = @issue.attachments.build(params[:attachment]) - @attachment.author_id = self.logged_in_user.id if self.logged_in_user + # Save the attachments + params[:attachments].each { |a| + @attachment = @issue.attachments.build(:file => a, :author => self.logged_in_user) unless a.size == 0 @attachment.save - end + } if params[:attachments] and params[:attachments].is_a? Array redirect_to :action => 'show', :id => @issue end diff --git a/redmine/app/controllers/projects_controller.rb b/redmine/app/controllers/projects_controller.rb index 8666dae0..9e1dc14e 100644 --- a/redmine/app/controllers/projects_controller.rb +++ b/redmine/app/controllers/projects_controller.rb @@ -187,11 +187,10 @@ class ProjectsController < ApplicationController else @issue.attributes = params[:issue] @issue.author_id = self.logged_in_user.id if self.logged_in_user - # Create the document if a file was sent - if params[:attachment][:file].size > 0 - @attachment = @issue.attachments.build(params[:attachment]) - @attachment.author_id = self.logged_in_user.id if self.logged_in_user - end + # Multiple file upload + params[:attachments].each { |a| + @attachment = @issue.attachments.build(:file => a, :author => self.logged_in_user) unless a.size == 0 + } if params[:attachments] and params[:attachments].is_a? Array @custom_values = @project.custom_fields_for_issues(@tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } @issue.custom_values = @custom_values if @issue.save diff --git a/redmine/app/views/issues/show.rhtml b/redmine/app/views/issues/show.rhtml index b1affb5a..104d3365 100644 --- a/redmine/app/views/issues/show.rhtml +++ b/redmine/app/views/issues/show.rhtml @@ -77,18 +77,6 @@ end %>
-<% if authorize_for('issues', 'add_note') %> -- <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %>
- <%= submit_tag l(:button_add) %> - <%= end_form_tag %> -+ <%= file_field_tag 'attachments[]', :size => 30 %>
<%= submit_tag l(:button_add) %> <%= end_form_tag %> <% end %>+ <%= text_area 'history', 'notes', :cols => 60, :rows => 10 %>
+ <%= submit_tag l(:button_add) %> + <%= end_form_tag %> +<%= custom_field_tag_with_label @custom_value %>
<% end %> --<%= file_field 'attachment', 'file' %>
++<%= file_field_tag 'attachments[]', :size => 30 %>
diff --git a/redmine/public/javascripts/application.js b/redmine/public/javascripts/application.js index d8083a95..3625914a 100644 --- a/redmine/public/javascripts/application.js +++ b/redmine/public/javascripts/application.js @@ -5,4 +5,15 @@ function checkAll (id, checked) { el.elements[i].checked = checked; } } +} + +function addFileField() { + var f = document.createElement("input"); + f.type = "file"; + f.name = "attachments[]"; + f.size = 30; + + p = document.getElementById("attachments_p"); + p.appendChild(document.createElement("br")); + p.appendChild(f); } \ No newline at end of file diff --git a/redmine/public/stylesheets/application.css b/redmine/public/stylesheets/application.css index d4b3bc5f..ef9736bd 100644 --- a/redmine/public/stylesheets/application.css +++ b/redmine/public/stylesheets/application.css @@ -198,6 +198,7 @@ textarea { input { vertical-align: middle; + margin-bottom: 4px; } input.button-small