This commit is contained in:
cxt 2015-10-16 17:32:28 +08:00
commit bfdfde8028
2 changed files with 12 additions and 7 deletions

View File

@ -2351,7 +2351,7 @@ module ApplicationHelper
def user_for_homework_common homework,is_teacher def user_for_homework_common homework,is_teacher
if User.current.member_of_course?(homework.course) if User.current.member_of_course?(homework.course)
if is_teacher #老师显示作品数量 if is_teacher #老师显示作品数量
link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
else #学生显示提交作品、修改作品等按钮 else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework work = cur_user_works_for_homework homework
if work.nil? if work.nil?
@ -2367,7 +2367,7 @@ module ApplicationHelper
end end
end end
else else
link_to "提交(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue" link_to "作品(#{homework.student_works.count})",student_work_index_path(:homework => homework.id),:class => "c_blue"
end end
end end

View File

@ -527,7 +527,7 @@
} }
function changeValue(value,data){ function changeValue(value,data){
//console.log(value+","+data) //console.log(value+","+data)
$("input[name='province']").val(value); $("input[name='province']").val(value);
$("input[name='occupation']").val(data); $("input[name='occupation']").val(data);
$("#search_school_result_list").hide(); $("#search_school_result_list").hide();
$("#hint").hide(); $("#hint").hide();
@ -570,7 +570,7 @@
var i = 0; var i = 0;
$("#search_school_result_list").html(''); $("#search_school_result_list").html('');
for (; i < data.length; i++) { for (; i < data.length; i++) {
link = '<a onclick="window.changeValue(\'' + data[i].school.name + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>'; link = '<a onclick="window.changeValue(\'' + data[i].school.name.replace(/\s/g," ") + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link); $("#search_school_result_list").append(link);
} }
$("#search_school_result_list").css('left', $(e.target).offset().left); $("#search_school_result_list").css('left', $(e.target).offset().left);
@ -601,7 +601,10 @@
} }
}) })
$("input[name='province']").on('focus', function (e) { $("input[name='province']").on('focus', function (e) {
if($(e.target).val() == ''){ if($(e.target).val() == ''){ //
return;
}
if( $("input[name='occupation']").val() != ''){ //如果已经有id了。肯定存在不用去找了。
return; return;
} }
$.ajax({ $.ajax({
@ -612,7 +615,7 @@
var i = 0; var i = 0;
$("#search_school_result_list").html(''); $("#search_school_result_list").html('');
for (; i < data.length; i++) { for (; i < data.length; i++) {
link = '<a onclick="window.changeValue(\'' + data[i].school.name + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>'; link = '<a onclick="window.changeValue(\'' + data[i].school.name.replace(/\s/g," ") + '\',\'' + data[i].school.id + '\')" href="javascript:void(0)">' + data[i].school.name + '</a><br/>';
$("#search_school_result_list").append(link); $("#search_school_result_list").append(link);
} }
$("#search_school_result_list").css('left', $(e.target).offset().left); $("#search_school_result_list").css('left', $(e.target).offset().left);
@ -658,8 +661,10 @@
<% if( !@act.nil? && @act == 'password') %> <% if( !@act.nil? && @act == 'password') %>
$("#users_tb_2").click(); $("#users_tb_2").click();
<% end %> <% end %>
$('#my_account_form_link').click(function(){ $('#my_account_form_link').click(function(e){
if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话 if( $("input[name='province']").val().trim() != '' && $("input[name='occupation']").val().trim() == ''){ //学校名字和id不对的话
$("#hint").html('<span style="color:red">学校必须是从下拉列表中选择的,不能手动修改</span>').show();
e.stopImmediatePropagation();
return; return;
} }
$('#my_account_form_btn').click(); $('#my_account_form_btn').click();