分组作业和团队竞赛在提交或修改作品时,选择“合作成员“的弹框中无法选择的成员提示不够明显

This commit is contained in:
cxt 2017-03-14 14:35:14 +08:00
parent e1c8fccf00
commit 4e2f82a187
4 changed files with 51 additions and 22 deletions

View File

@ -22,6 +22,7 @@
<div class="cl"></div>
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
<span class="c_red fl" id="choose_member_notice"></span>
<div class="cl"></div>
</div>
<script type="text/javascript">
@ -82,10 +83,8 @@
}
function delete_student(id) {
$("#choose_member_notice").hide();
$("#choose_student_"+id).remove();
$("#student_"+id).one("click",function choose_student() {
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
});
}
$(document).ready(function(){

View File

@ -22,13 +22,19 @@ if(lists.length > 0) {
<%# if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? && user.contestant_of_contest?(@contest) %>
<% if user.id.to_i != User.current.id.to_i && (@commit_student_ids.find{|e| e.to_i == user.id.to_i}).nil? %>
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);
$("#student_<%=user.id %>").on("click",function choose_student() {
if($("#choose_student_<%=user.id %>").length > 0){
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
} else{
$("#choose_member_notice").hide();
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.contestant_of_contest?(@contest) %>
@ -37,7 +43,15 @@ if (str.indexOf(<%=user.id.to_s %>) < 0 && choose_str.indexOf(<%=user.id.to_s %>
//}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该成员已加入其它分组");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已加入其它分组");
$("#choose_member_notice").show();
});
} else{
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
});
}
<% end %>
<% end %>

View File

@ -22,6 +22,7 @@
<div class="cl"></div>
<div class="courseSendCancel mr15" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickCanel();">取消</a></div>
<div class="courseSendSubmit" style="float:right;"><a href="javascript:void(0);" class="sendSourceText" onclick="clickOK()">确定</a></div>
<span class="c_red fl" id="choose_member_notice"></span>
<div class="cl"></div>
</div>
<script type="text/javascript">
@ -82,10 +83,8 @@
}
function delete_student(id) {
$("#choose_member_notice").hide();
$("#choose_student_"+id).remove();
$("#student_"+id).one("click",function choose_student() {
$("#choose_students_list").append("<li id='choose_student_"+id+"' onclick='delete_student("+id+");'>"+$("#student_"+id).html()+"</li>");
});
}
$(document).ready(function(){

View File

@ -21,22 +21,39 @@ $("#all_students_list").empty();
}
<% 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 %>
$("#student_<%=user.id %>").on("click",function choose_student() {
if($("#choose_student_<%=user.id %>").length > 0){
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
} else{
$("#choose_member_notice").hide();
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);
<% 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","该项目成员不是本课程的学生");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该项目成员不是本班级的学生");
$("#choose_member_notice").show();
});
}
<% else %>
if (str.indexOf(<%=user.id.to_s %>) < 0) {
$("#student_<%=user.id %>").attr("title","该学生已加入其它分组");
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该学生已加入其它分组");
$("#choose_member_notice").show();
});
} else{
$("#student_<%=user.id %>").on("click",function() {
$("#choose_member_notice").html("该成员已添加");
$("#choose_member_notice").show();
});
}
<% end %>
<% end %>