Merge branch 'memcached_alan' into szzh
This commit is contained in:
commit
27314f8b54
|
@ -1,9 +1,10 @@
|
|||
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message-form'} do |f| %>
|
||||
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'}, :html => {:nhname=>'form',:multipart => true, :id => 'message-form'} do |f| %>
|
||||
|
||||
<%= render :partial => 'form_course', :locals => {:f => f, :topic => @message} %>
|
||||
<li>
|
||||
<a href="javascript:void(0);" onclick="show_newtalk();" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0);" name="submitbtn" class="blue_btn fr " style="margin-left: 55px">
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0);" nhname="cancelbtn" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0);" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px">
|
||||
<%= l(:button_submit)%>
|
||||
</a>
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -1,26 +1,29 @@
|
|||
<div nhname="container_board">
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2 fl">
|
||||
<% if User.current.language == "zh"%>
|
||||
<%= h @board.name %>
|
||||
<% else %>
|
||||
<%= l(:project_module_boards) %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<!--display the board-->
|
||||
<div class="project_r_h">
|
||||
<h2 class="project_h2 fl">
|
||||
<% if User.current.language == "zh"%>
|
||||
<%= h @board.name %>
|
||||
<% else %>
|
||||
<%= l(:project_module_boards) %>
|
||||
</h2>
|
||||
<% if User.current.logged? %>
|
||||
<a href="javascript:void(0)" class="green_btn fr newtalk " id="new_topic_btn" nhname="showbtn"><%= l(:label_message_new) %></a>
|
||||
<% end %>
|
||||
|
||||
</h2>
|
||||
<a href="javascript:void(0)" class="green_btn fr newtalk " onclick="show_newtalk();"><%= l(:label_message_new) %></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class=" talklist_box" >
|
||||
<div class="talk_new ml15 mb10" nhname="about_talk" id="about_newtalk" style="display:none;" >
|
||||
<ul>
|
||||
<%= render :partial => 'course_new' %>
|
||||
</ul>
|
||||
</div><!--talknew end-->
|
||||
</div>
|
||||
</div>
|
||||
<!-- 发布新帖部分 -->
|
||||
<div class="cl"></div>
|
||||
<div class=" talklist_box" >
|
||||
<div class="talk_new ml15 mb10" name="container_board" id="about_newtalk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;" >
|
||||
<ul>
|
||||
<%= render :partial => 'course_new' %>
|
||||
</ul>
|
||||
</div><!--talknew end-->
|
||||
|
||||
<% if !User.current.logged?%>
|
||||
<div style="font-size: 14px;margin:20px;">
|
||||
|
@ -32,15 +35,19 @@
|
|||
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
|
||||
<% if @topics.any? %>
|
||||
<% @topics.each do |topic| %>
|
||||
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>">
|
||||
<div class="talkmain_box" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply">
|
||||
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
|
||||
<div class="talkmain_txt fl mt5">
|
||||
<% author = topic.author.to_s + ":" %>
|
||||
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
|
||||
<% author = topic.author.to_s %>
|
||||
<div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
|
||||
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl ",:title=>author,
|
||||
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
|
||||
</div>
|
||||
<p style="float:left;color:#ff5722;"> :</p>
|
||||
|
||||
<p class="talkmain_tit fl fb break_word"> <%= h(topic.subject) %></p>
|
||||
<p class="talkmain_tit fl fb break_word" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
||||
<% if topic.course_editable_by?(User.current) %>
|
||||
<a href="javascript:void(0)" onclick="show_newtalk1('#about_newtalk<%= topic.id%>');" style="color: #426e9a;float: right;
|
||||
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;
|
||||
margin-right: 10px;"><%= l(:button_edit) %></a>
|
||||
<% end %>
|
||||
|
||||
|
@ -81,105 +88,85 @@
|
|||
<%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
|
||||
|
||||
</div>
|
||||
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => 'message_content',:class => ' c_dblue fr' %>
|
||||
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
||||
|
||||
</div><!--讨论主类容 end-->
|
||||
<div class="talk_new ml15 mb10" id="about_newtalk<%=topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<%= render :partial => 'edit',locals: {:topic => topic} %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="talkWrapBox">
|
||||
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
|
||||
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml15 mb10" style="display: none" id="reply<%= topic.id %>" name="container_board">
|
||||
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'}, :html => {:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
||||
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<%= toggle_link l(:button_cancel), "reply" + topic.id.to_s, :focus => 'message_content',:class => 'grey_btn fr ml10' %>
|
||||
<a href="javascript:void(0)" name="submitbtn" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
|
||||
<% end %>
|
||||
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<%= render :partial => 'edit',locals: {:topic => topic} %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="talkWrapBox">
|
||||
<% reply = Message.new(:subject => "RE: #{topic.subject}")%>
|
||||
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply" style="display: none;">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% replies_all = topic.children.
|
||||
includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.created_on DESC").offset(2).
|
||||
all %>
|
||||
<% replies_show = topic.children.
|
||||
includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.created_on DESC").limit(2).
|
||||
all %>
|
||||
<% unless replies_show.empty? %>
|
||||
<% reply_count = 0 %>
|
||||
<div class="talkWrapMsg">
|
||||
<ul>
|
||||
<% replies_show.each do |message| %>
|
||||
<div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">
|
||||
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
|
||||
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
||||
|
||||
<li>
|
||||
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
|
||||
<div class="Msg_txt">
|
||||
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
|
||||
<br/>
|
||||
<p class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
||||
|
||||
<br/>
|
||||
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
|
||||
<%= link_to(
|
||||
|
||||
l(:button_delete),
|
||||
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete),
|
||||
:class => ' c_dblue fr'
|
||||
) if message.course_destroyable_by?(User.current) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
</li><!---留言内容-->
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
|
||||
<div style="padding-top:5px;" class="fr">
|
||||
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:button_submit)%></a>
|
||||
</div>
|
||||
<% end %>
|
||||
</ul>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="talkWrapMsg" id="talkWrapMsg<%= topic.id %>" style="display: none">
|
||||
<ul>
|
||||
<% replies_all.each do |message| %>
|
||||
<% end %>
|
||||
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.created_on DESC").all %>
|
||||
<% unless replies_all.empty? %>
|
||||
<% replies_all_i = 0 %>
|
||||
<div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
|
||||
<ul>
|
||||
<% replies_all.each do |message| %>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
|
||||
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
|
||||
<div class="Msg_txt">
|
||||
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
|
||||
<br/>
|
||||
<div class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></div>
|
||||
<input nhname="nh_content_val" value="<%= message.content %>" type="hidden"/>
|
||||
<br/><div class="cl"></div>
|
||||
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
|
||||
<%= link_to(
|
||||
|
||||
<li>
|
||||
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
|
||||
<div class="Msg_txt">
|
||||
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
|
||||
<br/>
|
||||
<p class="fl"><%= textAreailizable message,:content,:attachments => message.attachments %></p>
|
||||
l(:button_delete),
|
||||
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete),
|
||||
:class => ' c_dblue fr'
|
||||
) if message.course_destroyable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
'javascript:;',
|
||||
:nhname =>'showbtn_child_reply',
|
||||
:class => ' c_dblue fr',
|
||||
:style => 'margin-right: 10px;',
|
||||
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
<br/>
|
||||
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
|
||||
<%= link_to(
|
||||
</li><!---留言内容-->
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%if topic.replies_count>2 %>
|
||||
<div class="talkWrapMsg"><a nhname="reply_ex_btn" data-count="<%= topic.replies_count %>" data-init="0" class=" ml258" href="javascript:void(0)" id="showgithelp<%= topic.id%>" value="show_help" class="c_dblue lh23" style="color: #0781b4;" >展开回复(<%= topic.replies_count.to_s%>)</a></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div><!--讨论主类容 end-->
|
||||
|
||||
l(:button_delete),
|
||||
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete),
|
||||
:class => ' c_dblue fr'
|
||||
) if message.course_destroyable_by?(User.current) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
||||
</li><!---留言内容-->
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%if replies_all.first %>
|
||||
<div class="talkWrapMsg"><a class=" ml258" href="javascript:void(0)" id="showgithelp<%= topic.id%>" value="show_help" onclick ="showhelpAndScrollToMessage('talkWrapMsg<%= topic.id %>','#showgithelp<%= topic.id%>','<%=topic.replies_count%>'); " class="c_dblue lh23" style="color: #0781b4;" >展开回复(<%= topic.replies_count.to_s%>)</a></div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
|
@ -197,58 +184,80 @@
|
|||
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@course}: #{@board}") %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div style="display:none;"><a href="#" id="nhjump"></a></div>
|
||||
<script type="text/javascript">
|
||||
//submitProjectsBoard()
|
||||
KindEditor.ready(function(K){
|
||||
$("div[name='container_board']").each(function(){
|
||||
var container=$(this);
|
||||
var messege = $("p[aa='message_show']",container);
|
||||
var subject = $("input[aa='subject']",container);
|
||||
var textarea= $("textarea[aa='content']",container);
|
||||
var form = $("form",container);
|
||||
var editor = K.create(textarea, {
|
||||
resizeType : 1,
|
||||
allowPreviewEmoticons : false,
|
||||
allowImageUpload : false,
|
||||
width:"89%",
|
||||
items : []
|
||||
});
|
||||
// form.submit(function(){
|
||||
// alert(textarea.html());
|
||||
// });
|
||||
// $("a[name='submitbtn']",container).click(function(){
|
||||
// form.submit();
|
||||
// });
|
||||
|
||||
$("a[name='submitbtn']",container).click(function(){
|
||||
textarea[0].value = editor.html() ;
|
||||
var id = textarea[0].id.toString().substr(15);
|
||||
|
||||
if(subject.val() == "RE: ") {
|
||||
|
||||
if (editor.html() == "") {
|
||||
messege.html("回复内容不能为空") ;
|
||||
messege.css('color', '#ff0000');
|
||||
messege.show();
|
||||
}
|
||||
else {
|
||||
messege.html("填写正确");
|
||||
messege.css('color', '#008000');
|
||||
messege.show();
|
||||
this.parentNode.submit();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(regexContent(id) && regexSubject(id)) {
|
||||
if (this.parentNode.name == 'message-form') {
|
||||
this.parentNode.submit();
|
||||
}
|
||||
else
|
||||
this.parentNode.parentNode.submit();
|
||||
}
|
||||
$(function(){
|
||||
$(".talkmain_box").each(function(){
|
||||
var target = $("li[nhname='reply_rec']",$(this));
|
||||
var btn = $("a[nhname='reply_ex_btn']",$(this));
|
||||
var jumpobj = $("div[nhname='nh_reply_div']",$(this));
|
||||
btn.click(function(){
|
||||
if($(this).data('init')=='0'){
|
||||
$(this).data('init',1);
|
||||
$(this).html('收起回复('+$(this).data('count')+')');
|
||||
target.show();
|
||||
}else{
|
||||
$(this).data('init',0);
|
||||
$(this).html('展开回复('+$(this).data('count')+')');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
$("#nhjump").attr('href','#'+jumpobj.attr('id'));
|
||||
$("#nhjump")[0].click();
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
KindEditor.ready(function(K){
|
||||
$("div[nhname='container_board']").each(function(){
|
||||
var container = $(this);
|
||||
var about_talk = $("div[nhname='about_talk']",container);
|
||||
var params = ({
|
||||
kindutil:K,
|
||||
showbtn:$("a[nhname='showbtn']",container),
|
||||
about_talk:about_talk,
|
||||
inputsubject:$("input[nhname='inputsubject']",about_talk),
|
||||
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
|
||||
textarea:$("textarea[nhname='textarea']",about_talk),
|
||||
contentmsg:$("p[nhname='contentmsg']",about_talk),
|
||||
submitbtn:$("a[nhname='submitbtn']",about_talk),
|
||||
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
|
||||
form:$("form[nhname='form']",about_talk),
|
||||
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
|
||||
init_content_val:$("input[nhname='init_content_val']",about_talk)
|
||||
});
|
||||
nh_init_board(params);
|
||||
});
|
||||
$("div[mhname='container_board_reply']").each(function(){
|
||||
var container = $(this);
|
||||
var about_talk = $("div[nhname='about_talk_reply']",container);
|
||||
var params = {
|
||||
type:'reply',
|
||||
kindutil:K,
|
||||
showbtn:$("a[nhname='showbtn_reply']",container),
|
||||
showbtn_child:$("a[nhname='showbtn_child_reply']",container),
|
||||
about_talk:about_talk,
|
||||
inputsubject:$("input[nhname='inputsubject']",about_talk),
|
||||
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
|
||||
textarea:$("textarea[nhname='textarea']",about_talk),
|
||||
contentmsg:$("p[nhname='contentmsg']",about_talk),
|
||||
submitbtn:$("a[nhname='submitbtn']",about_talk),
|
||||
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
|
||||
form:$("form[nhname='form']",about_talk),
|
||||
quote_show:$("div[nhname='quote_show']",about_talk),
|
||||
quote_input:$("textarea[nhname='quote_input']",about_talk),
|
||||
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
|
||||
jumphref:$("#nhjump")
|
||||
};
|
||||
params.get_ref_str_call=function(btn){
|
||||
var div = btn.parent('div');
|
||||
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'</blockquote>';
|
||||
return str;
|
||||
}
|
||||
nh_init_board(params);
|
||||
});
|
||||
<% if(!@flag.nil? && @flag=='true') %>
|
||||
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
|
||||
<% end %>
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -12,6 +12,7 @@
|
|||
} do |f| %>
|
||||
<%= render :partial => 'form_project',
|
||||
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0)" nhname='cancelbtn' class="blue_btn grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0)" nhname='submitbtn' class="blue_btn fr c_white" ><%= l(:button_submit)%></a>
|
||||
<%#= link_to l(:button_cancel), board_message_url(topic.board, topic.root, :r => (topic.parent_id && topic.id)), :class => "blue_btn grey_btn fl c_white" %>
|
||||
|
@ -31,6 +32,7 @@
|
|||
} do |f| %>
|
||||
<%= render :partial => 'form_course',
|
||||
:locals => {:f => f, :replying => !topic.parent.nil?, :topic => topic} %>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0)" nhname='cancelbtn' class="blue_btn grey_btn fr c_white ml10"><%= l(:button_cancel) %></a>
|
||||
<a href="javascript:void(0)" nhname='submitbtn' class="blue_btn fr c_white"><%= l(:button_submit)%></a>
|
||||
|
||||
|
|
|
@ -5,19 +5,19 @@
|
|||
<li style="display: none">
|
||||
<label><span class="c_red">*</span> <%= l(:field_subject) %> :</label>
|
||||
|
||||
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585", :aa=>"subject" }.merge(extra_option) %>
|
||||
<%= f.text_field :subject, { size: 60, id: "message_subject",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
|
||||
|
||||
|
||||
<p id="subject_span<%= f.object.id%>" class="ml55"></p>
|
||||
<p nhname="subjectmsg" class="ml55"></p>
|
||||
</li>
|
||||
<% else %>
|
||||
<li >
|
||||
<label><span class="c_red">*</span> <%= l(:field_subject) %> :</label>
|
||||
|
||||
|
||||
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :aa=>"subject" }.merge(extra_option) %>
|
||||
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}", onkeyup: "regexSubject('#{f.object.id}');",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
|
||||
|
||||
<p id="subject_span<%= f.object.id%>" class="ml55"></p>
|
||||
<p nhname="subjectmsg" class="ml55"></p>
|
||||
</li>
|
||||
<% end %>
|
||||
<li class="ml60 mb5">
|
||||
|
@ -34,11 +34,11 @@
|
|||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<div nhname="quote_show" id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<% unless replying %>
|
||||
<label class="fl ml3" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<% end %>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
|
||||
<div class="content">
|
||||
<% if replying%>
|
||||
|
||||
|
@ -46,13 +46,14 @@
|
|||
:width => '89%',
|
||||
:height => 300,
|
||||
:id => "message_content#{f.object.id}",
|
||||
:aa => 'content',
|
||||
:nhname => 'textarea',
|
||||
:onkeyup => "regexContent('#{f.object.id}');",
|
||||
:class => 'talk_text fl',
|
||||
:placeholder => "最多3000个汉字(或6000个英文字符)",
|
||||
:maxlength => 5000 %>
|
||||
|
||||
<% else %>
|
||||
<input nhname="init_content_val" value="<%=topic.content%>" type="hidden"/>
|
||||
<%= f.text_area :content,
|
||||
:width => '90%',
|
||||
:height => 300,
|
||||
|
@ -61,14 +62,14 @@
|
|||
:id => "message_content#{f.object.id}",
|
||||
:onkeyup => "regexContent('#{f.object.id}');",
|
||||
:class => 'talk_text fl',
|
||||
:aa => 'content',
|
||||
:nhname => 'textarea',
|
||||
:placeholder => "最多3000个汉字(或6000个英文字符)",
|
||||
:maxlength => 5000 %>
|
||||
|
||||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p id="message_content_span<%= f.object.id%>" aa="message_show" class="ml55"></p>
|
||||
<p id="message_content_span<%= f.object.id%>" nhname="contentmsg" class="ml55"></p>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
|
||||
<style>
|
||||
.comment{
|
||||
position: relative;
|
||||
|
@ -15,7 +14,7 @@
|
|||
<% replying ||= false %>
|
||||
<% extra_option = replying ? { readonly: true} : { maxlength: 200 } %>
|
||||
<% if replying %>
|
||||
<li style="display: none">
|
||||
<li style="display: none;">
|
||||
<label><span class="c_red">*</span> <%= l(:field_subject) %> :</label>
|
||||
|
||||
<%= f.text_field :subject, { size: 60, id: "message_subject#{f.object.id}",:class=>"talk_input w585", :nhname=>'inputsubject' }.merge(extra_option) %>
|
||||
|
@ -47,12 +46,13 @@
|
|||
<div class="cl"></div>
|
||||
</li>
|
||||
<li>
|
||||
<div id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<div nhname="quote_show" id="message_quote" class="wiki" style="width: 100%;word-break: break-all;word-wrap: break-word;"></div>
|
||||
<% unless replying %>
|
||||
<label class="fl ml3" ><span class="c_red">*</span> <%= l(:field_description) %> :</label>
|
||||
<% end %>
|
||||
<%= text_area :quote,:quote,:style => 'display:none' %>
|
||||
<div class="content">
|
||||
<%= text_area :quote,:quote,:style => 'display:none',:nhname=>"quote_input" %>
|
||||
|
||||
<div class="content <%= replying ? '':'ml55' %>">
|
||||
<% if replying%>
|
||||
|
||||
<%= f.text_area :content,
|
||||
|
@ -66,6 +66,7 @@
|
|||
:maxlength => 5000 %>
|
||||
|
||||
<% else %>
|
||||
<input nhname="init_content_val" value="<%=topic.content%>" type="hidden"/>
|
||||
<%= f.text_area :content,
|
||||
:width => '90%',
|
||||
:height => 300,
|
||||
|
@ -81,7 +82,11 @@
|
|||
<% end %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<p nhname="contentmsg" class="ml55"></p>
|
||||
<% if replying%>
|
||||
<p nhname="contentmsg"></p>
|
||||
<% else %>
|
||||
<p nhname="contentmsg" class="ml55"></p>
|
||||
<%end %>
|
||||
</li>
|
||||
<div class="cl"></div>
|
||||
<li>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:nhname=>'form', :html => {:multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
|
||||
<%= form_for @message, :url =>{:controller=>'messages',:action => 'new', :board_id => @board.id, :is_board => 'true'},:html => {:nhname=>'form', :multipart => true, :id => 'message-form', :name=>'message-form'} do |f| %>
|
||||
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :topic => @message} %>
|
||||
<li>
|
||||
<div class="ml55 fl" nhname="toolbar_container"></div>
|
||||
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10"><%= l(:button_cancel) %></a>
|
||||
|
||||
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style="margin-left: 55px"><%= l(:button_submit)%></a>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<% end %>
|
||||
</h2>
|
||||
<% if User.current.logged? %>
|
||||
<a href="javascript:void(0)" class="green_btn fr newtalk " nhname="showbtn"><%= l(:label_message_new) %></a>
|
||||
<a href="javascript:void(0)" class="green_btn fr newtalk " id="new_topic_btn" nhname="showbtn"><%= l(:label_message_new) %></a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -20,7 +20,7 @@
|
|||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class=" talklist_box" >
|
||||
<div class="talk_new ml15 mb10" nhname="about_talk" style="display:<%= !@flag.nil? && @flag=='true' ? 'block' : 'none' %>;">
|
||||
<div class="talk_new ml15 mb10" nhname="about_talk" style="display:none;">
|
||||
<ul>
|
||||
<%= render :partial => 'project_new_topic' %>
|
||||
</ul>
|
||||
|
@ -31,141 +31,175 @@
|
|||
<p class="c_dark mb5">讨论区共有<span class="c_orange"><%= @topic_count %></span>个帖子</p>
|
||||
<% if @topics.any? %>
|
||||
<% @topics.each do |topic| %>
|
||||
<div nhname="container_board" ecname="container_board_reply">
|
||||
<div class="talkmain_box" id="topic<%= topic.id %>" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
|
||||
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
|
||||
<div class="talkmain_txt fl mt5">
|
||||
<% author = topic.author.to_s + ":" %>
|
||||
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl " %>
|
||||
<p class="talkmain_tit fl fb break_word"> <%= h(topic.subject) %></p>
|
||||
<% if topic.editable_by?(User.current) %>
|
||||
<a href="javascript:void(0)" nhname="showbtn_reply" style="color: #426e9a;float: right;margin-right: 10px;"><%= l(:button_edit) %></a>
|
||||
<% end %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'talk_edit fr',
|
||||
:style => ' margin-right: 10px;'
|
||||
) if topic.destroyable_by?(User.current) %>
|
||||
<% if topic.sticky? %>
|
||||
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="project_board_content break_word" id="content_<%=topic.id%>">
|
||||
<div id="contentmessage<%=topic.id %>" class="upload_img">
|
||||
<%= topic.content.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display: none" id="project_show_<%= topic.id%>">
|
||||
<a id="expend_more_information<%= topic.id%>" style="color: #0781b4;" href="javascript:void(0)" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
|
||||
<span class="g-arr-down">
|
||||
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
|
||||
</span>
|
||||
</p>
|
||||
<%= link_to_attachments_course topic, :author => false %>
|
||||
<%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<%= toggle_link l(:button_reply), "reply" + topic.id.to_s, :focus => "about_newtalk#{topic.id}",:class => ' c_dblue fr' %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<%= render :partial => 'edit',locals: {:topic => topic} %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="talkmain_box" id="topic<%= topic.id %>" nhname="container_board" mhname="container_board_reply" style="border:none; margin-bottom:0; border-bottom: 1px dashed #d9d9d9;">
|
||||
<%= link_to image_tag(url_to_avatar(topic.author), :width=>"42",:height=>"42"), user_path(topic.author),:class =>'talkmain_pic fl' %>
|
||||
<div class="talkmain_txt fl mt5">
|
||||
<% author = topic.author.to_s %>
|
||||
<div style="max-width:60px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;">
|
||||
<%= link_to author, user_path(topic.author), :class =>"talkmain_name fl ",:title=>author,
|
||||
:style=>'max-width:60px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;' %>
|
||||
</div>
|
||||
<p style="float:left;color:#ff5722;"> :</p>
|
||||
|
||||
<div class="talkWrapBox">
|
||||
<% reply = Message.new(:subject => "RE: #{@message.subject}")%>
|
||||
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml15 mb10" style="display:none;" nhname="about_talk_reply" id="reply<%= topic.id %>">
|
||||
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
|
||||
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<a href="javascript:void(0)" nhname="cancelbtn" class="blue_btn fr ml10" style=""><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:label_memo_create)%></a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
<p class="talkmain_tit fl fb break_word" title="<%= h(topic.subject) %>" style="width:auto;float:left;max-width:415px;white-space:nowrap;overflow:hidden;float:left;text-overflow:ellipsis;"> <%= h(topic.subject) %></p>
|
||||
<div style="float:right;max-width:110px;">
|
||||
<% if topic.editable_by?(User.current) %>
|
||||
<a href="javascript:void(0)" nhname="showbtn" style="color: #426e9a;float: right;margin-right: 10px;"><%= l(:button_edit) %></a>
|
||||
<% end %>
|
||||
<%= link_to(
|
||||
l(:button_delete),
|
||||
{:controller =>'messages',:action => 'destroy', :id => topic.id, :board_id => topic.board_id, :is_board=>'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:class => 'talk_edit fr',
|
||||
:style => ' margin-right: 10px;'
|
||||
) if topic.destroyable_by?(User.current) %>
|
||||
<% if topic.sticky? %>
|
||||
<a href="javascript:void(0)" class="talk_up fr c_red" style="margin-right: 10px;"><%= l(:label_board_sticky)%></a>
|
||||
<% end %>
|
||||
<script>
|
||||
$(function(){if($("#contentmessage<%=topic.id %>").height()>182){$("#project_show_<%= topic.id%>").show();}});
|
||||
</script>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="project_board_content break_word" id="content_<%=topic.id%>">
|
||||
<div id="contentmessage<%=topic.id %>" class="upload_img">
|
||||
<%= topic.content.html_safe %>
|
||||
</div>
|
||||
</div>
|
||||
<p style="display: none;" id="project_show_<%= topic.id%>">
|
||||
<a id="expend_more_information<%= topic.id%>" style="color: #0781b4;" href="javascript:void(0)" onclick="show_more_reply('#content_<%=topic.id%>','#expend_more_information<%= topic.id%>','#arrow<%=topic.id%>');" value="show_more">[展开]</a>
|
||||
<span class="g-arr-down">
|
||||
<img id="arrow<%=topic.id%>" src="/images/jiantou.jpg" width="12" height="6" />
|
||||
</span>
|
||||
</p>
|
||||
<%= link_to_attachments_course topic, :author => false %>
|
||||
<%= l(:label_activity_time)%>: <%= format_time topic.created_on %>
|
||||
</div>
|
||||
<% if User.current.logged? %>
|
||||
<a href="javascript:void(0)" nhname="showbtn_reply" class="c_dblue fr" style="margin-right:10px;"><%= l(:button_reply) %></a>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<div class="talk_new ml15 mb10" nhname='about_talk' id="about_newtalk<%=topic.id%>" style="display: none">
|
||||
<ul>
|
||||
<%= render :partial => 'edit',locals: {:topic => topic} %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<div class="talkWrapBox">
|
||||
<% reply = Message.new(:subject => "RE: #{topic.subject}")%>
|
||||
<% if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
<div class="talkWrapMsg" nhname="about_talk_reply" style="display: none;">
|
||||
<em class="talkWrapArrow"></em>
|
||||
<div class="cl"></div>
|
||||
<div class="talkConIpt ml15 mb10" style="margin-left:30px;" id="reply<%= topic.id %>">
|
||||
<%= form_for reply, :as => :reply, :url => {:controller=>'messages',:action => 'reply', :id => topic.id, :board_id => topic.board_id, :is_board => 'true'},
|
||||
:html => {:nhname=>"form",:multipart => true, :id => 'message_form' + topic.id.to_s, :name=>'message-form'} do |f| %>
|
||||
<%= render :partial => 'form_project', :locals => {:f => f, :replying => true} %>
|
||||
<div class="fl" style="padding-top:5px;" nhname="toolbar_container"></div>
|
||||
<div style="padding-top:5px;" class="fr">
|
||||
<a href="javascript:void(0)" nhname="cancelbtn" class="grey_btn fr ml10" style=""><%= l(:button_cancel)%></a>
|
||||
<a href="javascript:void(0)" nhname="submitbtn" class="blue_btn fr " style=""><%= l(:button_submit)%></a>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
<% replies_all = topic.children.includes(:author, :attachments, {:board => :project}).
|
||||
reorder("#{Message.table_name}.id desc").all %>
|
||||
<% unless replies_all.empty? %>
|
||||
<div class="talkWrapMsg" nhname="nh_reply_div" id="nh_reply_div_<%= topic.id %>">
|
||||
<ul>
|
||||
<% replies_all_i = 0 %>
|
||||
<% replies_all.each do |message| %>
|
||||
<% replies_all_i=replies_all_i+1 %>
|
||||
<li nhname="reply_rec" style="display:<%= replies_all_i>2?'none':'' %>">
|
||||
<%= link_to image_tag(url_to_avatar(message.author), :width => '34',:height => '34'), user_path(message.author), :class =>'Msg_pic' %>
|
||||
<div class="Msg_txt">
|
||||
<%= link_to_user_header message.author,false,:class => 'fl c_orange ' %>
|
||||
<br/>
|
||||
<div class="fl break_word"><%= textAreailizable message,:content,:attachments => message.attachments %></div>
|
||||
<input nhname="nh_content_val" type="hidden" value="<%= message.content %>"/>
|
||||
<br/><div class="cl"></div>
|
||||
<span class=" c_grey fl"><%= format_time(message.created_on) %></span>
|
||||
<%= link_to(
|
||||
|
||||
l(:button_delete),
|
||||
{:controller => 'messages', :action => 'destroy', :id => message.id, :board_id => message.board_id, :is_board => 'true'},
|
||||
:method => :post,
|
||||
:data => {:confirm => l(:text_are_you_sure)},
|
||||
:title => l(:button_delete),
|
||||
:class => ' c_dblue fr'
|
||||
) if message.course_destroyable_by?(User.current) %>
|
||||
<%= link_to(
|
||||
l(:button_reply),
|
||||
'javascript:;',
|
||||
:nhname =>'showbtn_child_reply',
|
||||
:class => ' c_dblue fr',
|
||||
:style => 'margin-right: 10px;',
|
||||
:title => l(:button_reply)) if !topic.locked? && authorize_for('messages', 'reply') %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<%if topic.replies_count>2 %>
|
||||
<div class="talkWrapMsg">
|
||||
<a nhname="reply_ex_btn" data-count="<%= topic.replies_count %>" data-init="0" href="javascript:void(0)" class="ml258 c_dblue lh23">展开回复(<%= topic.replies_count.to_s%>)</a>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<p class="nodata"><%= l(:label_no_data) %></p>
|
||||
<% end %>
|
||||
<ul class="wlist">
|
||||
<%= pagination_links_full @topic_pages, @topic_count, :per_page_links => false, :remote => false, :flag => true %>
|
||||
</ul>
|
||||
<!--讨论主类容 end-->
|
||||
|
||||
<%# other_formats_links do |f| %>
|
||||
<%#= f.link_to 'Atom', :url => {:key => User.current.rss_key} %>
|
||||
<%# end %>
|
||||
<% html_title @board.name %>
|
||||
<% content_for :header_tags do %>
|
||||
<%= auto_discovery_link_tag(:atom, {:format => 'atom', :key => User.current.rss_key}, :title => "#{@project}: #{@board}") %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div style="display:none;"><a href="#" id="nhjump"></a></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
|
||||
if($.trim(params.subject.val()) == ""){
|
||||
params.subjectmsg.html('主题不能为空');
|
||||
params.subjectmsg.css({color:'#ff0000'});
|
||||
result=false;
|
||||
}else{
|
||||
params.subjectmsg.html('填写正确');
|
||||
params.subjectmsg.css({color:'#008000'});
|
||||
}
|
||||
params.subjectmsg.show();
|
||||
|
||||
if($.trim(params.content.html()) == ""){
|
||||
params.contentmsg.html('内容不能为空');
|
||||
params.contentmsg.css({color:'#ff0000'});
|
||||
result=false;
|
||||
}else{
|
||||
params.contentmsg.html('填写正确');
|
||||
params.contentmsg.css({color:'#008000'});
|
||||
}
|
||||
params.contentmsg.show();
|
||||
|
||||
return result;
|
||||
}
|
||||
function nh_init_board(params){
|
||||
params.showbtn.click(function(){//发帖/编辑/回复按钮的click
|
||||
if(params.textarea.data('init') == undefined){
|
||||
var editor = params.kindutil.create(params.textarea, {//初始化编辑器
|
||||
resizeType : 1,
|
||||
allowPreviewEmoticons : false,
|
||||
allowImageUpload : false,
|
||||
minWidth:"1px",
|
||||
width:"565px",
|
||||
items : []
|
||||
});
|
||||
params.submitbtn.click(function(){//提交按钮click
|
||||
var is_checked = nh_check_field({
|
||||
subject:params.inputsubject,
|
||||
subjectmsg:params.subjectmsg,
|
||||
content:editor,
|
||||
contentmsg:params.contentmsg,
|
||||
});
|
||||
if(is_checked){
|
||||
alert('submit');
|
||||
params.textarea.html(editor.html());
|
||||
// params.form.submit();
|
||||
}
|
||||
});
|
||||
params.cancelbtn.click(function(){//取消按钮click
|
||||
params.about_talk.toggle();//显示/隐藏编辑区
|
||||
params.inputsubject.focus();
|
||||
});
|
||||
params.textarea.data('init','1')
|
||||
}
|
||||
params.cancelbtn.click();//显示/隐藏编辑区
|
||||
});
|
||||
}
|
||||
$(function(){
|
||||
$(".talkmain_box").each(function(){
|
||||
var target = $("li[nhname='reply_rec']",$(this));
|
||||
var btn = $("a[nhname='reply_ex_btn']",$(this));
|
||||
var jumpobj = $("div[nhname='nh_reply_div']",$(this));
|
||||
btn.click(function(){
|
||||
if($(this).data('init')=='0'){
|
||||
$(this).data('init',1);
|
||||
$(this).html('收起回复('+$(this).data('count')+')');
|
||||
target.show();
|
||||
}else{
|
||||
$(this).data('init',0);
|
||||
$(this).html('展开回复('+$(this).data('count')+')');
|
||||
target.hide();
|
||||
target.eq(0).show();
|
||||
target.eq(1).show();
|
||||
$("#nhjump").attr('href','#'+jumpobj.attr('id'));
|
||||
$("#nhjump")[0].click();
|
||||
}
|
||||
});
|
||||
});
|
||||
KindEditor.ready(function(K){
|
||||
$("div[nhname='container_board']").each(function(){
|
||||
var container = $(this);
|
||||
var about_talk = $("div[nhname='about_talk']",container);
|
||||
nh_init_board({
|
||||
var params = ({
|
||||
kindutil:K,
|
||||
showbtn:$("a[nhname='showbtn']",container),
|
||||
about_talk:about_talk,
|
||||
|
@ -175,15 +209,20 @@
|
|||
contentmsg:$("p[nhname='contentmsg']",about_talk),
|
||||
submitbtn:$("a[nhname='submitbtn']",about_talk),
|
||||
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
|
||||
form:$("form[nhname='form']",about_talk)
|
||||
form:$("form[nhname='form']",about_talk),
|
||||
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
|
||||
init_content_val:$("input[nhname='init_content_val']",about_talk)
|
||||
});
|
||||
nh_init_board(params);
|
||||
});
|
||||
$("div[ecname='container_board_reply']").each(function(){
|
||||
$("div[mhname='container_board_reply']").each(function(){
|
||||
var container = $(this);
|
||||
var about_talk = $("div[nhname='about_talk_reply']",container);
|
||||
nh_init_board({
|
||||
var params = {
|
||||
type:'reply',
|
||||
kindutil:K,
|
||||
showbtn:$("a[nhname='showbtn_reply']",container),
|
||||
showbtn_child:$("a[nhname='showbtn_child_reply']",container),
|
||||
about_talk:about_talk,
|
||||
inputsubject:$("input[nhname='inputsubject']",about_talk),
|
||||
subjectmsg:$("p[nhname='subjectmsg']",about_talk),
|
||||
|
@ -191,9 +230,22 @@
|
|||
contentmsg:$("p[nhname='contentmsg']",about_talk),
|
||||
submitbtn:$("a[nhname='submitbtn']",about_talk),
|
||||
cancelbtn:$("a[nhname='cancelbtn']",about_talk),
|
||||
form:$("form[nhname='form']",about_talk)
|
||||
});
|
||||
form:$("form[nhname='form']",about_talk),
|
||||
quote_show:$("div[nhname='quote_show']",about_talk),
|
||||
quote_input:$("textarea[nhname='quote_input']",about_talk),
|
||||
toolbar_container:$("div[nhname='toolbar_container']",about_talk),
|
||||
jumphref:$("#nhjump")
|
||||
};
|
||||
params.get_ref_str_call=function(btn){
|
||||
var div = btn.parent('div');
|
||||
var str = '<blockquote>'+$('a',div).filter(':first').html()+' 写到: <br/>'+$("input[nhname='nh_content_val']",div).val()+'</blockquote>';
|
||||
return str;
|
||||
}
|
||||
nh_init_board(params);
|
||||
});
|
||||
<% if(!@flag.nil? && @flag=='true') %>
|
||||
if($("#new_topic_btn")!=undefined)$("#new_topic_btn").click();
|
||||
<% end %>
|
||||
});
|
||||
});
|
||||
</script>
|
|
@ -1,3 +1,13 @@
|
|||
<style>
|
||||
.ke-toolbar{display:none;width:400px;border:none;background:none;padding:0px 0px;}
|
||||
.ke-toolbar-icon{line-height:26px;font-size:14px;padding-left:26px;}
|
||||
.ke-toolbar-icon-url{background-image:url( '/images/public_icon.png' )}
|
||||
.ke-toolbar .ke-outline{padding:0px 0px;line-height:26px;font-size:14px;}
|
||||
.ke-icon-emoticons{background-position:0px -671px;width:50px;height:26px;}
|
||||
.ke-icon-emoticons:hover{background-position:-79px -671px;width:50px;height:26px;}
|
||||
.ke-toolbar .ke-outline{border:none;}
|
||||
.break_word {width:100%;}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
//头部导航
|
||||
var menuids=["TopUserNav"] //Enter id(s) of SuckerTree UL menus, separated by commas
|
||||
|
@ -21,55 +31,182 @@
|
|||
else if (window.attachEvent)
|
||||
window.attachEvent("onload", buildsubmenus)
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">//侧导航
|
||||
|
||||
window.onload = function () {
|
||||
var topic_id = getParam('topic_id');
|
||||
document.getElementById(topic_id).focus();
|
||||
}
|
||||
|
||||
var getParam = function(name){
|
||||
var search = document.location.search;
|
||||
var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
|
||||
var matcher = pattern.exec(search);
|
||||
var items = null;
|
||||
if(null != matcher){
|
||||
try{
|
||||
items = decodeURIComponent(decodeURIComponent(matcher[1]));
|
||||
}catch(e){
|
||||
try{
|
||||
items = decodeURIComponent(matcher[1]);
|
||||
}catch(e){
|
||||
items = matcher[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return items;
|
||||
};
|
||||
|
||||
function show_newtalk()
|
||||
{
|
||||
$("#about_newtalk").toggle();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function show_newtalk1(id)
|
||||
{
|
||||
$(id).toggle();
|
||||
$(id).focus();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<%= javascript_include_tag "/assets/kindeditor/kindeditor-min" %>
|
||||
|
||||
<% if @project %>
|
||||
<%= render :partial => 'project_show', locals: {project: @project} %>
|
||||
<% elsif @course %>
|
||||
<%= render :partial => 'course_show', locals: {course: @course} %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">//侧导航
|
||||
|
||||
//window.onload = function () {
|
||||
// var topic_id = getParam('topic_id');
|
||||
// document.getElementById(topic_id).focus();
|
||||
//}
|
||||
//
|
||||
//var getParam = function(name){
|
||||
// var search = document.location.search;
|
||||
// var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
|
||||
// var matcher = pattern.exec(search);
|
||||
// var items = null;
|
||||
// if(null != matcher){
|
||||
// try{
|
||||
// items = decodeURIComponent(decodeURIComponent(matcher[1]));
|
||||
// }catch(e){
|
||||
// try{
|
||||
// items = decodeURIComponent(matcher[1]);
|
||||
// }catch(e){
|
||||
// items = matcher[1];
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return items;
|
||||
//};
|
||||
//
|
||||
//function show_newtalk()
|
||||
//{
|
||||
// $("#about_newtalk").toggle();
|
||||
//
|
||||
//
|
||||
//
|
||||
//}
|
||||
//
|
||||
//function show_newtalk1(id)
|
||||
//{
|
||||
// $(id).toggle();
|
||||
// $(id).focus();
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
function nh_check_field(params){
|
||||
var result=true;
|
||||
if(params.subject!=undefined){
|
||||
if($.trim(params.subject.val()) == ""){
|
||||
params.subjectmsg.html('主题不能为空');
|
||||
params.subjectmsg.css({color:'#ff0000'});
|
||||
result=false;
|
||||
}else{
|
||||
params.subjectmsg.html('填写正确');
|
||||
params.subjectmsg.css({color:'#008000'});
|
||||
}
|
||||
params.subjectmsg.show();
|
||||
}
|
||||
|
||||
if(params.content!=undefined){
|
||||
if(params.content.isEmpty()){
|
||||
result=false;
|
||||
}
|
||||
if(params.content.html()!=params.textarea.html() || params.issubmit==true){
|
||||
params.textarea.html(params.content.html());
|
||||
if(params.content.isEmpty()){
|
||||
params.contentmsg.html('内容不能为空');
|
||||
params.contentmsg.css({color:'#ff0000'});
|
||||
}else{
|
||||
params.contentmsg.html('填写正确');
|
||||
params.contentmsg.css({color:'#008000'});
|
||||
}
|
||||
params.contentmsg.show();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
function nh_init_board(params){
|
||||
//发帖/编辑/回复按钮的click
|
||||
params.showbtn.click(function(){
|
||||
if(params.textarea.data('init') == undefined){
|
||||
//初始化编辑器
|
||||
var editor = params.kindutil.create(params.textarea, {
|
||||
resizeType : 1,
|
||||
allowPreviewEmoticons : false,
|
||||
allowImageUpload : false,
|
||||
minWidth:"1px",
|
||||
width:"565px",
|
||||
items : ['emoticons'],
|
||||
afterChange:function(){//按键事件
|
||||
nh_check_field({content:this,contentmsg:params.contentmsg,textarea:params.textarea});
|
||||
},
|
||||
afterCreate:function(){
|
||||
var toolbar = $("div[class='ke-toolbar']",params.about_talk);
|
||||
$(".ke-outline>.ke-toolbar-icon",toolbar).append('表情');
|
||||
params.toolbar_container.append(toolbar);
|
||||
}
|
||||
});
|
||||
|
||||
//主题输入框按键事件
|
||||
params.inputsubject.keyup(function(){
|
||||
nh_check_field({subject:params.inputsubject,subjectmsg:params.subjectmsg});
|
||||
})
|
||||
//表单提交
|
||||
params.form.submit(function(){
|
||||
var is_checked = nh_check_field({
|
||||
issubmit:true,
|
||||
subject:params.inputsubject,
|
||||
subjectmsg:params.subjectmsg,
|
||||
content:editor,
|
||||
contentmsg:params.contentmsg,
|
||||
textarea:params.textarea
|
||||
});
|
||||
if(is_checked){
|
||||
//return true 居然不提交 fuck your sister
|
||||
$(this)[0].submit();
|
||||
// return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
//提交按钮click
|
||||
params.submitbtn.click(function(){
|
||||
params.form.submit();
|
||||
});
|
||||
//取消按钮click
|
||||
params.cancelbtn.click(function(){
|
||||
params.about_talk.toggle();//显示/隐藏编辑区
|
||||
if(params.about_talk.is(':hidden')){//隐藏时reset表单数据
|
||||
params.form[0].reset();
|
||||
if(params.type=='reply'){
|
||||
params.textarea.empty();
|
||||
}else{
|
||||
params.textarea.html(params.init_content_val.val());
|
||||
}
|
||||
var str = params.textarea.html();
|
||||
str=str.replace(new RegExp(/</g),'<');
|
||||
str=str.replace(new RegExp(/>/g),'>');
|
||||
editor.html(str);
|
||||
params.subjectmsg.hide();
|
||||
params.contentmsg.hide();
|
||||
if(params.quote_show!=undefined)params.quote_show.empty();
|
||||
if(params.quote_input!=undefined)params.quote_input.empty();
|
||||
}else{
|
||||
if(params.type=='reply'){
|
||||
params.jumphref.attr('href','#'+params.form.attr('id'));
|
||||
params.jumphref[0].click();
|
||||
}else params.inputsubject.focus();
|
||||
}
|
||||
});
|
||||
params.textarea.data('init','1');//标记为已经初始化
|
||||
}
|
||||
params.cancelbtn.click();//显示/隐藏编辑区
|
||||
});
|
||||
if(params.type == 'reply'){
|
||||
params.showbtn_child.click(function(){
|
||||
if(params.textarea.data('init') == undefined){
|
||||
params.showbtn.click();
|
||||
}else{
|
||||
params.cancelbtn.click();
|
||||
if(params.about_talk.is(':hidden')){
|
||||
params.cancelbtn.click();
|
||||
}
|
||||
}
|
||||
var ref_str = params.get_ref_str_call($(this));
|
||||
params.quote_show.html(ref_str);
|
||||
params.quote_input.html(ref_str);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
</script>
|
Binary file not shown.
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 12 KiB |
Loading…
Reference in New Issue