This commit is contained in:
sw 2015-09-09 16:54:21 +08:00
commit 519f079bcc
11 changed files with 51 additions and 26 deletions

View File

@ -82,13 +82,19 @@ function nh_init_board(params){
var editor = params.kindutil.create(params.textarea, {
// allowPreviewEmoticons : false,
// allowImageUpload : false,
autoHeightMode : true,
resizeType : 1,minWidth:"1px",width:"560px",height:"150px",
allowFileManager:true,uploadJson:"/kindeditor/upload",
fileManagerJson:"/kindeditor/filemanager",
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
// var edit = this.edit;
// var body = edit.doc.body;
// edit.iframe.height(minHeight);
// this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 30, minHeight));
},
afterCreate:function(){
this.loadPlugin("autoheight");
var userAgent = navigator.userAgent.toLowerCase();
if(/trident/.test(userAgent)){
$("div.talk_new .ke-container").css({'margin-left':'0px'});

View File

@ -10,11 +10,11 @@
div.respond-form .reply_btn{margin-left:565px;margin-top:5px;}
div.recall_con{width:570px;}
div.recall_con .reply_btn{margin-left:525px;margin-top:5px;}
.ke-container{height: 80px !important;}
/*.ke-container{height: 80px !important;}*/
</style>
<%= javascript_include_tag "/assets/kindeditor/kindeditor",'/assets/kindeditor/pasteimg',"init_KindEditor" %>
<script >
init_KindEditor_data('');
init_KindEditor_data('',80);
</script>
<div class="msg_box fl mb10" id='leave-message'>
<h4><%= l(:label_leave_message) %></h4>
@ -62,6 +62,7 @@
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("input[nhname='cancel_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);

View File

@ -81,8 +81,8 @@
<div class="navHomepageProfile">
<ul>
<li class="homepageProfileMenuIcon">
<%= link_to "<div class='mt5 mb8'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
<ul class="topnav_login_list">
<%= link_to "<div class='mt5 mb8' id='user_avatar'>#{image_tag(url_to_avatar(User.current),:width =>"40",:height => "40",:class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe,user_activities_path(User.current.id)%>
<ul class="topnav_login_list" id="topnav_login_list">
<li>
<%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
</li>
@ -110,6 +110,12 @@
$("#navHomepageSearchType").hide();
});
$("#user_avatar").mouseover(function(){
$("#topnav_login_list").show();
}).mouseout(function(){
$("#topnav_login_list").hide();
});
function signout(){
$.post(
'<%= signout_path%>',

View File

@ -8,7 +8,7 @@
span.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
span.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
div.ke-toolbar .ke-outline{border:none;}
.ke-container{height: 80px !important;}
/*.ke-container{height: 80px !important;}*/
</style>
<div >
<div class="homepageRightBanner mb10">
@ -20,7 +20,7 @@
<div class="message_box mb10" id="users_setting">
<div nhname='new_message' style="display:none;">
<%= form_for('new_form',:url => leave_user_message_path(@user.id),:method => "post") do |f|%>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
<p nhname='contentmsg'></p>
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:6px;">取消</a>

View File

@ -899,6 +899,7 @@ ActiveRecord::Schema.define(:version => 20150907152238) do
t.datetime "created_on"
t.integer "comments_count", :default => 0, :null => false
t.integer "course_id"
t.datetime "updated_on"
end
add_index "news", ["author_id"], :name => "index_news_on_author_id"

View File

@ -7,7 +7,9 @@ module RailsKindeditor
input_html = input_html.merge(style: 'display:none')
output = ActiveSupport::SafeBuffer.new
output << text_area_tag(name, content, input_html)
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true')))
output << javascript_tag(js_replace(id, options.merge(window_onload: 'true',
:autoHeightMode=>true,
afterCreate: 'eval(function(){enablePasteImg(self);this.loadPlugin("autoheight")})')))
end
def kindeditor(name, method, options = {})

View File

@ -1,14 +1,18 @@
function init_editor(params){
var minHeight;
// var minHeight; //最小高度
var paramsHeight = params.height; //设定的高度
var editor = params.kindutil.create(params.textarea, {
resizeType : 1,minWidth:"1px",width:"100%",height:"30px",minHeight:"30px",
resizeType : 1,minWidth:"1px",width:"100%",
height:"30px",// == undefined ? "30px":paramsHeight+"px",
minHeight:"30px",// == undefined ? "30px":paramsHeight+"px",
items:['emoticons'],
afterChange:function(){//按键事件
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
var edit = this.edit;
var body = edit.doc.body;
edit.iframe.height(minHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + 30, minHeight));
edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight) + (paramsHeight == undefined ? 30:paramsHeight), paramsHeight));
},
afterCreate:function(){
var toolbar = $("div[class='ke-toolbar']",params.div_form);
@ -22,9 +26,9 @@ function init_editor(params){
//reset height
var edit = this.edit;
var body = edit.doc.body;
minHeight = params.kindutil.removeUnit(this.height);
edit.iframe.height(minHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ 30 , minHeight));
paramsHeight = paramsHeight == undefined ? params.kindutil.removeUnit(this.height) : paramsHeight;
edit.iframe.height(paramsHeight);
this.resize(null, Math.max((params.kindutil.IE ? body.scrollHeight : body.offsetHeight)+ (paramsHeight == undefined ? 30:paramsHeight) , paramsHeight));
}
}).loadPlugin('paste');
@ -83,8 +87,9 @@ function nh_reset_form(params){
}
params.contentmsg.hide();
}
//第二个参数是高度,可以传,可以不传
function init_KindEditor_data(id){
var height = arguments[1] ? arguments[1] : undefined;
KindEditor.ready(function (K) {
$("div[nhname='new_message_" + id + "']").each(function () {
var params = {};
@ -99,7 +104,7 @@ function init_KindEditor_data(id){
params.toolbar_container = $("div[nhname='toolbar_container_" + id + "']", params.div_form);
params.cancel_btn = $("#new_message_cancel_btn_" + id);
params.submit_btn = $("#new_message_submit_btn_" + id);
params.height = height;
if (params.textarea.data('init') == undefined) {
params.editor = init_editor(params);
init_form(params);

View File

@ -8,11 +8,12 @@ $(function(){
params.div_form = $("div[nhname='div_form']",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.textarea.prev('div').css("height","60px");
//params.textarea.prev('div').css("height","60px");
params.contentmsg = $("p[nhname='contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("a[nhname='cancel_btn']",params.div_form);
params.submit_btn = $("a[nhname='submit_btn']",params.div_form);
params.height = 55;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
@ -42,11 +43,12 @@ $(function(){
params.div_form = $("div[nhname='sub_div_form']",params.container);
params.form = $("form",params.div_form);
params.textarea = $("textarea[name='user_notes']",params.div_form);
params.textarea.prev('div').css("height","60px");
//params.textarea.prev('div').css("height","60px");
params.contentmsg = $("p[nhname='sub_contentmsg']",params.div_form);
params.toolbar_container = $("div[nhname='sub_toolbar_container']",params.div_form);
params.cancel_btn = $("a[nhname='sub_cancel_btn']",params.div_form);
params.submit_btn = $("a[nhname='sub_submit_btn']",params.div_form);
params.height = 45;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);
@ -82,7 +84,7 @@ $(function(){
params.toolbar_container = $("div[nhname='toolbar_container']",params.div_form);
params.cancel_btn = $("#new_message_cancel_btn");
params.submit_btn = $("#new_message_submit_btn");
params.height = 80;
if(params.textarea.data('init') == undefined){
params.editor = init_editor(params);
init_form(params);

View File

@ -18,8 +18,6 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.navHomepageProfile {width:65px; display:block; float:right; margin-left:33px;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block;}
.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) 30px -122px no-repeat;}
.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}
.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;}
.homepageRight {width:750px; float:left; margin-top:15px; margin-bottom:10px;}
.homepagePortraitContainer {width:238px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px; padding-bottom:15px;}
@ -90,7 +88,7 @@ li.menuArrow:hover {background:url(../images/item.png) -20px -70px no-repeat;}
a.topnav_login_box:hover {color:#a1ebff;}
.navRow1 {margin:0; padding:0;}
.navRow2 {margin:0; padding:0;}
.topnav_login_list{ border:1px solid #15bccf; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;margin-top: -5px;}
.topnav_login_list{diaplay:none; border:1px solid #15bccf; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;margin-top: -5px;}
.topnav_login_list a{color:#15bccf;}
.topnav_login_list li{ }

View File

@ -261,7 +261,7 @@ li.menuArrow:hover {background:url(../images/item.png) -20px -70px no-repeat;}
a.topnav_login_box:hover {color:#a1ebff;}
.navRow1 {margin:0; padding:0;}
.navRow2 {margin:0; padding:0;}
.topnav_login_list{ border:1px solid #269ac9; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;}
.topnav_login_list{display: none; border:1px solid #269ac9; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-7px; position:absolute; z-index:9999; line-height:2;}
.topnav_login_list a{color:#269ac9;}
.topnav_login_list li{ }
@ -462,8 +462,6 @@ a.homepageSearchIcon:hover {background:url(../images/nav_icon.png) -49px 3px no-
.portraitRadius {border-radius: 3px;}
.homepageProfileMenuIcon {background:url(../images/nav_icon.png) 30px -155px no-repeat; width:65px; height:54px; position:relative; display:inline-block;}
.homepageProfileMenuIcon:hover {background:url(../images/nav_icon.png) 30px -122px no-repeat;}
.navHomepageProfile ul li ul {display:none;}
.navHomepageProfile ul li:hover ul {display:block;}
.homepageLeft {width:240px; float:left; margin-right:10px; margin-bottom:10px;}
.homepageRight {width:750px; float:left; margin-top:15px; margin-bottom:10px;}
.homepagePortraitContainer {width:208px; border:1px solid #dddddd; background-color:#ffffff; margin-top:15px; padding:15px;}
@ -608,7 +606,7 @@ a:hover.gz_btn{ color:#ff5722;}
.loginContent {width:1000px; margin:0px auto;}
.loginLeft {width:595px; float:left;}
.loginLogo {padding-left:208px; padding-top:155px;}
.loginInro {width:465px; padding-top:55px; padding-left:50px; font-size:16px; color:#ffffff;}
.loginInro {width:465px; padding-top:66px; padding-left:50px; font-size:16px; color:#ffffff; text-indent: 2em;}
.loginRight {width:405px; float:left;}
.loginChooseBox {width:405px; height:54px; background-color:#ffffff; padding-top:18px;}
.loginChooseList {width:350px; height:30px; font-size:14px; margin:0px auto;}
@ -673,6 +671,8 @@ a.referenceTypeBlock {color:#888888; display:inline-block; padding:0px 20px;}
/*20150826协议 LB*/
.AgreementBox{ margin:20px 0; color:#666666; font-size:14px; line-height:1.9;}
.Agreementh4{ color:#2980b9; font-weight:bold; font-size:14px; margin-top:30px; border: none;}
.AgreementTxt{text-indent: 2em; margin-bottom: 15px;}
.AgreementImg{margin: 0px auto; width: 820px;}
/*底部*/
#Footer{background-color:#ffffff; padding-bottom:15px; color:#666666;} /*margin-bottom:10px;*/

View File

@ -534,3 +534,7 @@ a.resourcesBlack:hover {font-size:12px; color:#000000;}
background-color: #64bdd9;
outline:none;
}
.AgreementBox{margin: 20px 0; color: #666666; font-size: 14px; line-height: 1.9;}
.AgreementTxt{text-indent: 2em; margin-bottom: 15px;}
.AgreementImg{margin: 0px auto; width: 820px;}