42 lines
1.8 KiB
Plaintext
42 lines
1.8 KiB
Plaintext
$("#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);
|
|
|
|
var str = $("#group_member_ids").val();
|
|
var choose_str = "";
|
|
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,"");
|
|
choose_str += id;
|
|
if (i != lists.length -1) {
|
|
choose_str += ",";
|
|
}
|
|
}
|
|
}
|
|
<% 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) %>
|
|
if (str.indexOf(<%=user.id.to_s %>) < 0 && choose_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()+"<input name='member_id[]' value='<%=user.id %>' type='hidden'/></li>";
|
|
$("#choose_students_list").append(li);
|
|
});
|
|
}
|
|
<% elsif !user.member_of_course?(@course) %>
|
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
|
$("#student_<%=user.id %>").attr("title","该项目成员不是本课程的学生");
|
|
}
|
|
<% else %>
|
|
if (str.indexOf(<%=user.id.to_s %>) < 0) {
|
|
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
|
|
}
|
|
<% end %>
|
|
<% end %> |