2015-12-11 14:57:09 +08:00
|
|
|
$("#all_students_list").empty();
|
|
|
|
<% @users.each do |user|%>
|
|
|
|
var link = "<li id='student_<%=user.id %>'><%=user.show_name %>";
|
|
|
|
<% unless user.user_extensions.student_id == "" %>
|
|
|
|
link += "(<%=user.user_extensions.student_id %>)";
|
|
|
|
<% end %>
|
|
|
|
link += "</li>";
|
|
|
|
$("#all_students_list").append(link);
|
|
|
|
|
2016-06-14 17:36:12 +08:00
|
|
|
var str = $("#group_member_ids").val();
|
|
|
|
/*var str = "";
|
2015-12-11 14:57:09 +08:00
|
|
|
var lists = $("#choose_students_list li");
|
|
|
|
if(lists.length > 0) {
|
|
|
|
for(var i=0; i<lists.length; i++) {
|
|
|
|
var id = $(lists[i]).attr("id").replace(/[^0-9]/ig,"");
|
|
|
|
str += id;
|
|
|
|
if (i != lists.length -1) {
|
|
|
|
str += ",";
|
|
|
|
}
|
|
|
|
}
|
2016-06-14 17:36:12 +08:00
|
|
|
}*/
|
2015-12-17 15:28:28 +08:00
|
|
|
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.member_of_course?(@course) %>
|
2015-12-11 14:57:09 +08:00
|
|
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
|
|
|
$("#student_<%=user.id %>").one("click",function choose_student() {
|
|
|
|
var li = "<li id='choose_student_<%=user.id %>'";
|
|
|
|
<% if user.id.to_i != User.current.id.to_i %>
|
|
|
|
li += " onclick='delete_student(<%=user.id %>);'";
|
|
|
|
<% end %>
|
|
|
|
li += ">" + $("#student_<%=user.id %>").html()+"</li>";
|
|
|
|
$("#choose_students_list").append(li);
|
|
|
|
});
|
|
|
|
}
|
2015-12-17 15:28:28 +08:00
|
|
|
<% elsif !user.member_of_course?(@course) %>
|
|
|
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
|
|
|
$("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生");
|
|
|
|
}
|
2015-12-11 15:31:15 +08:00
|
|
|
<% else %>
|
|
|
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
|
|
|
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
|
|
|
|
}
|
2015-12-11 14:57:09 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|