parent
78cb9815a7
commit
052d293f82
|
@ -65,6 +65,16 @@ module ProjectsHelper
|
|||
content_tag('div', content, :class => "tabs")
|
||||
end
|
||||
|
||||
# 判断我的项目中是否有重名项目
|
||||
def judge_same_projectname(user, project_name)
|
||||
result = false
|
||||
my_projects = user.projects
|
||||
my_projects.each do |mp|
|
||||
result = true if mp.name == project_name
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
# Added by young
|
||||
def course_settings_tabs
|
||||
tabs = [{:name => 'info', :action => :edit_project, :partial => 'projects/edit', :label => :label_information_plural, :course=>'1'},
|
||||
|
|
|
@ -425,4 +425,35 @@ $(function(){
|
|||
|
||||
personalized_init();
|
||||
});
|
||||
//cookie记忆html区块 显示/隐藏 的代码 end
|
||||
//cookie记忆html区块 显示/隐藏 的代码 end
|
||||
|
||||
// 新建项目的时候判断是否与我已有的项目重复
|
||||
function judgeprojectname(){
|
||||
$('#new_project').validate({
|
||||
errorPlacement: function(error, element){
|
||||
alert('error')
|
||||
},
|
||||
success: function(label){
|
||||
alert('ok')
|
||||
},
|
||||
onkeyup: false,
|
||||
rules : {
|
||||
name:{required : true,
|
||||
remote : {
|
||||
url : 'projects/judge_same_projectname',
|
||||
type:'get',
|
||||
dataType:'text',
|
||||
data:{
|
||||
name : function(){ return $.trim( $("#name").val() ); }
|
||||
},
|
||||
dataFilter:function( data ){
|
||||
if( data=='true')return false; else return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
messages : {
|
||||
name:{required : "请填写项目名称!",remote:'您已新建过同名项目,请修改项目名称!'}
|
||||
}
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue