发送资源的时候不选任何课程项目的时候不要弹出框发送成功

This commit is contained in:
lizanle 2015-08-27 11:02:20 +08:00
parent 0a898342d9
commit 54c849cccb
4 changed files with 31 additions and 6 deletions

View File

@ -1066,10 +1066,14 @@ class UsersController < ApplicationController
# 将资源发送到对应的课程,分为发送单个,或者批量发送
def add_exist_file_to_course
@flag = true
if params[:send_id].present?
send_id = params[:send_id]
ori = Attachment.find_by_id(send_id)
course_ids = params[:course_ids]
if course_ids.nil?
@flag = false
end
unless course_ids.nil?
course_ids.each do |id|
next if ori.blank?
@ -1087,9 +1091,13 @@ class UsersController < ApplicationController
end
elsif params[:send_ids].present?
send_ids = params[:send_ids].split(" ")
course_ids = params[:course_ids]
if course_ids.nil?
@flag = false
end
send_ids.each do |send_id|
ori = Attachment.find_by_id(send_id)
course_ids = params[:course_ids]
unless course_ids.nil?
course_ids.each do |id|
next if ori.blank?
@ -1106,6 +1114,8 @@ class UsersController < ApplicationController
end
end
end
else
@flag = false
end
respond_to do |format|
format.js
@ -1114,9 +1124,13 @@ class UsersController < ApplicationController
# 添加资源到对应的项目
def add_exist_file_to_project
@flag = true
if params[:send_id].present?
send_id = params[:send_id]
project_ids = params[:projects_ids]
if project_ids.nil?
@flag = false
end
ori = Attachment.find_by_id(send_id)
unless project_ids.nil?
project_ids.each do |project_id|
@ -1134,8 +1148,12 @@ class UsersController < ApplicationController
end
elsif params[:send_ids].present?
send_ids = params[:send_ids].split(" ")
project_ids = params[:projects_ids]
if project_ids.nil?
@flag = false
end
send_ids.each do |send_id|
project_ids = params[:projects_ids]
ori = Attachment.find_by_id(send_id)
unless project_ids.nil?
project_ids.each do |project_id|
@ -1153,6 +1171,7 @@ class UsersController < ApplicationController
end
end
else
@flag=true
end
respond_to do |format|

View File

@ -1,2 +1,5 @@
<% if @flag == true%>
alert('发送成功')
closeModal();
closeModal();
<% else%>
<% end %>

View File

@ -1,2 +1,5 @@
alert('发送成功');
closeModal();
<% if @flag == true%>
alert('发送成功')
closeModal();
<% else%>
<% end %>

View File

@ -161,7 +161,7 @@ $(".resourcesList").mousedown(function(e) {
line = line.parent();
}
//将当前的元素的所有子元素的背景色改为蓝色
line.children().css("background-color", '#00ffff');
line.children().css("background-color", '#e1e1e1');
//将当前元素赋给 上一个对象 保存起来。
last_line = line;
}