From 676cf8f18030aa8d2438e2c2632e421fca2d23a0 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 15 Apr 2015 16:00:45 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=B8=8A=E4=BC=A0=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E6=98=AF=E6=A0=B9=E6=8D=AE=E4=B8=8A=E4=BC=A0=E7=9A=84?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=EF=BC=8C=E5=AF=B9=E8=B5=84=E6=BA=90=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E9=BB=98=E8=AE=A4=E7=9A=84TAG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/files_controller.rb | 21 +++++++++++++++++ app/views/files/_course_file.html.erb | 31 ++++++++++++++++++------- app/views/files/_upload_show.html.erb | 2 +- app/views/files/upload_file_show.js.erb | 20 ++++++++-------- config/locales/zh.yml | 5 ++++ 5 files changed, 60 insertions(+), 19 deletions(-) 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 @@