comparison app/controllers/files_controller.rb @ 1338:25603efa57b5

Merge from live branch
author Chris Cannam
date Thu, 20 Jun 2013 13:14:14 +0100
parents bb32da3bea34
children 4f746d8966dd
comparison
equal deleted inserted replaced
1209:1b1138f6f55e 1338:25603efa57b5
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
1 class FilesController < ApplicationController 18 class FilesController < ApplicationController
2 menu_item :files 19 menu_item :files
3 20
4 before_filter :find_project_by_project_id 21 before_filter :find_project_by_project_id
5 before_filter :authorize 22 before_filter :authorize
28 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id])) 45 container = (params[:version_id].blank? ? @project : @project.versions.find_by_id(params[:version_id]))
29 attachments = Attachment.attach_files(container, params[:attachments]) 46 attachments = Attachment.attach_files(container, params[:attachments])
30 render_attachment_warning_if_needed(container) 47 render_attachment_warning_if_needed(container)
31 48
32 if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added') 49 if !attachments.empty? && !attachments[:files].blank? && Setting.notified_events.include?('file_added')
33 Mailer.deliver_attachments_added(attachments[:files]) 50 Mailer.attachments_added(attachments[:files]).deliver
34 end 51 end
35 redirect_to project_files_path(@project) 52 redirect_to project_files_path(@project)
36 end 53 end
37 54
38 end 55 end