diff --git a/app/controllers/files_controller.rb b/app/controllers/files_controller.rb index 1ca3e2fcf..c9380516c 100644 --- a/app/controllers/files_controller.rb +++ b/app/controllers/files_controller.rb @@ -346,6 +346,27 @@ class FilesController < ApplicationController Mailer.run.attachments_added(attachments[:files]) end + if params[:course_attachment_type] && params[:course_attachment_type] != "5" + case params[:course_attachment_type] + when "1" + tag_name = l(:label_courseware) + when "2" + tag_name = l(:label_software) + when "3" + tag_name = l(:label_media) + when "4" + tag_name = l(:label_code) + else + tag_name = "" + end + if !attachments.empty? && attachments[:files] && tag_name != "" + attachments[:files].each do |attachment| + attachment.tag_list.add(tag_name) + attachment.save + end + end + end + # TODO: 临时用 nyan sort_init 'created_on', 'desc' sort_update 'created_on' => "#{Attachment.table_name}.created_on", diff --git a/app/views/files/_course_file.html.erb b/app/views/files/_course_file.html.erb index 73828f2fe..2bc780a27 100644 --- a/app/views/files/_course_file.html.erb +++ b/app/views/files/_course_file.html.erb @@ -1,7 +1,23 @@