模式二添加回复功能,模式一回复超过三行则隐藏
This commit is contained in:
parent
39dd62580a
commit
557e731343
|
@ -113,7 +113,7 @@ class SubDocumentCommentsController < ApplicationController
|
||||||
@org_subfield = @subdomain.org_subfield
|
@org_subfield = @subdomain.org_subfield
|
||||||
@organization = @org_subfield.organization
|
@organization = @org_subfield.organization
|
||||||
@comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain_id, :creator_id => User.current.id, :reply_id => params[:id])
|
@comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain_id, :creator_id => User.current.id, :reply_id => params[:id])
|
||||||
@comment.content = params[:org_comment][:sub_content]
|
@comment.content = params[:flag] ? params[:sub_content] : params[:org_comment][:sub_content]
|
||||||
@document.children << @comment
|
@document.children << @comment
|
||||||
@document.save
|
@document.save
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -13,37 +13,37 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!--回复-->
|
<!--回复-->
|
||||||
|
<% if User.current.logged? %>
|
||||||
<% comments_for_doc = @document.children.reorder("created_at desc") %>
|
<% comments_for_doc = @document.children.reorder("created_at desc") %>
|
||||||
<% count = @document.children.count() %>
|
<% count = @document.children.count() %>
|
||||||
<div class="sn-replybox">
|
<div class="sn-replybox">
|
||||||
<h2 class="sn-reply-h2">留言板<span class="sn-fr sn-f14 sn-font-grey3 sn-mt10">80条留言</span></h2>
|
<h2 class="sn-reply-h2">留言板<span class="sn-fr sn-f14 sn-font-grey3 sn-mt10"><%= count %>条留言</span></h2>
|
||||||
<form class="sn-reply-form">
|
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'sub_document_comments', :id => @document.id, :flag => true}, :html => {:multipart => true, :id => 'message_form', :class => "sn-reply-form", } do |f| %>
|
||||||
<textarea class="sn-reply-text" name="" ></textarea>
|
<textarea class="sn-reply-text" name="sub_content" ></textarea>
|
||||||
|
<%#= f.kindeditor :sub_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor', :class => "sn-reply-text" %>
|
||||||
<div class="sn-reply-btnbox">
|
<div class="sn-reply-btnbox">
|
||||||
<a href="javascript:void(0)" class="submit-btn">发表</a>
|
<%= link_to l(:button_reply), "javascript:void(0)", :onclick => "$('#message_form').submit();", :class => "submit-btn" %>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
<%#= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<div class="sn-reply-comment">
|
<div class="sn-reply-comment">
|
||||||
<h2 class="sn-comment-h2">全部评论</h2>
|
<h2 class="sn-comment-h2">全部评论</h2>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
<% comments_for_doc.each_with_index do |reply,i| %>
|
||||||
<div class="sn-comment-listbox">
|
<div class="sn-comment-listbox">
|
||||||
<a href="javascript:void(0)" class="sn-reply-userpic fl"><img src="images/img-news-con.jpg" width="824" height="522" alt="" /></a>
|
<a href="javascript:void(0)" class="sn-reply-userpic fl"><img src="images/img-news-con.jpg" width="824" height="522" alt="" /></a>
|
||||||
<a href="javascript:void(0)" class="sn-reply-username fl">与再有</a><span class="fl">10分钟</span>
|
<%= link_to User.find(reply.creator_id).realname, user_url_in_org(reply.creator_id), :class => "sn-reply-username fl" %><span class="fl"><%= time_from_now(reply.created_at) %></span>
|
||||||
<p class="fl sn-reply-usertxt ">北斗真棒,北斗加油</p>
|
<p class="fl sn-reply-usertxt "><%= reply.content.html_safe unless reply.content.nil? %></p>
|
||||||
<a href="javascript:void()" target="_blank" class="sn-reply-zan fl">(100)</a>
|
<!--<a href="javascript:void(0)" target="_blank" class="sn-reply-zan fl">(100)</a>-->
|
||||||
<div class="cl"></div>
|
|
||||||
</div>
|
|
||||||
<div class="sn-comment-listbox">
|
|
||||||
<a href="javascript:void(0)" class="sn-reply-userpic fl"><img src="images/img-news-con.jpg" width="824" height="522" alt="" /></a>
|
|
||||||
<a href="javascript:void(0)" class="sn-reply-username fl">与再有</a><span class="fl">10分钟</span>
|
|
||||||
<p class="fl sn-reply-usertxt ">北斗真棒,北斗加油</p>
|
|
||||||
<a href="javascript:void()" target="_blank" class="sn-reply-zan fl">(100)</a>
|
|
||||||
<div class="cl"></div>
|
<div class="cl"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
<div class="sn-reply-more">
|
<div class="sn-reply-more">
|
||||||
<a href="javascript:void(0)" class="">加载更多</a>
|
<a href="javascript:void(0)" class="">加载更多</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
|
@ -81,6 +81,13 @@
|
||||||
<%# end %>
|
<%# end %>
|
||||||
<!--</span>-->
|
<!--</span>-->
|
||||||
</div>
|
</div>
|
||||||
|
<% if count > 3 %>
|
||||||
|
<div class="homepagePostReplyBannerMore">
|
||||||
|
<a id="reply_btn_<%= document.id %>" onclick="expand_reply('#reply_div_<%= document.id %> li','#reply_btn_<%=document.id%>')" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help">
|
||||||
|
展开更多
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="" id="reply_div_<%= @document.id %>">
|
<div class="" id="reply_div_<%= @document.id %>">
|
||||||
<% comments_for_doc.each_with_index do |reply,i| %>
|
<% comments_for_doc.each_with_index do |reply,i| %>
|
||||||
|
|
Loading…
Reference in New Issue