diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 76ce9efaf..f62286973 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -823,9 +823,16 @@ class UsersController < ApplicationController end end - # 删除用户资源 + # 删除用户资源,分为批量删除 和 单个删除 def user_resource_delete + if params[:resource_id].present? Attachment.delete(params[:resource_id]) + elsif params[:checkbox1].present? + params[:checkbox1].each do |id| + Attachment.delete(id) + end + end + #@attachments = Attachment.where("author_id = #{params[:id]} and container_type in('Project','Principal','Course','Issue','Document','Message','News','StudentWorkScore','HomewCommon') ").order("created_on desc") if(params[:type].nil? || params[:type] == "1") #全部 if User.current.id.to_i == params[:id].to_i diff --git a/app/views/users/_resources_list.html.erb b/app/views/users/_resources_list.html.erb index 7a18a037b..62e819b43 100644 --- a/app/views/users/_resources_list.html.erb +++ b/app/views/users/_resources_list.html.erb @@ -3,7 +3,7 @@ <% attachments.each do |attach| %> +
+ <%= render :partial => 'resources_list' ,:locals=>{ :attachments => @attachments} %> +
- +
- 全选 - 删除 + 全选 + 删除
选择 0 个资源
+