编辑名称检查
This commit is contained in:
parent
35dd56d51c
commit
befd8d66f6
|
@ -296,7 +296,7 @@ class ForumsController < ApplicationController
|
|||
|
||||
#检查forum的名字
|
||||
def check_forum_name
|
||||
forum_name_exist = Forum.where("name = '#{params[:forum_name]}'").count >= 1 ? true : false
|
||||
forum_name_exist = Forum.where("name = '#{params[:forum_name]}' and id != #{params[:forum_id]}").count >= 1 ? true : false
|
||||
render :text => forum_name_exist
|
||||
end
|
||||
|
||||
|
|
|
@ -43,13 +43,10 @@
|
|||
function check_forum_name(){
|
||||
check_pass = true;
|
||||
name = $("textarea[name='forum[name]']").val().trim();
|
||||
if(name == '<%= @forum.name%>'){
|
||||
return;
|
||||
}
|
||||
if( name != ""){
|
||||
$.get(
|
||||
'<%= check_forum_name_forums_path %>',
|
||||
{"forum_name":name},
|
||||
{"forum_name":name,"forum_id":<%= @forum.id%>},
|
||||
function(data){
|
||||
|
||||
if( data == 'true'){
|
||||
|
|
Loading…
Reference in New Issue