parent
7663db693a
commit
d6c763edb0
|
@ -14,7 +14,7 @@ class Forum < ActiveRecord::Base
|
|||
'sticky',
|
||||
'locked'
|
||||
validates_presence_of :name, :creator_id, :description
|
||||
validates_length_of :name, maximum: 50
|
||||
validates_length_of :name, maximum: 160
|
||||
#validates_length_of :description, maximum: 255
|
||||
validates :name, :uniqueness => true
|
||||
after_destroy :delete_kindeditor_assets
|
||||
|
|
|
@ -29,5 +29,5 @@
|
|||
</div>
|
||||
<div class="creatPost">
|
||||
<a href="javascript:void(0);" id="create_btn" class="c_white db creatPostIcon bBlue"
|
||||
onclick="$('#error').hide();$('#new_forum_div').slideToggle();$(this).parent().slideToggle();">新建贴吧</a></div>
|
||||
onclick="$('#error').hide();clear_form();$('#new_forum_div').slideToggle();$(this).parent().slideToggle();">新建贴吧</a></div>
|
||||
<div class="cl"></div>
|
|
@ -49,7 +49,21 @@
|
|||
$("#reorder_popu").removeClass("sortArrowActiveD");
|
||||
add_class("reorder_time");
|
||||
});
|
||||
|
||||
document.getElementById('forum_name').onkeydown = function()
|
||||
{
|
||||
var n = 0;
|
||||
var str = this.value;
|
||||
for (i = 0; i < str.length; i++) {
|
||||
var leg = str.charCodeAt(i);//ASCII码
|
||||
if (leg > 255) {//大于255的都是中文
|
||||
n += 2;//如果是中文就是2个字节
|
||||
} else {
|
||||
n += 1;//英文,不多说了
|
||||
}
|
||||
}
|
||||
if(n >= 160)
|
||||
event.returnValue = false;
|
||||
}
|
||||
});
|
||||
function check_and_submit(doc){
|
||||
$("#error").html('').hide();
|
||||
|
@ -88,6 +102,9 @@
|
|||
$('#error').hide();
|
||||
$('#new_forum_div').slideToggle();
|
||||
$('#create_btn').parent().slideToggle();
|
||||
clear_form();
|
||||
}
|
||||
function clear_form(){
|
||||
$("#forum_name").val('');
|
||||
$("#forum_desc").val('');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue