二级目录讨论区添加帖子回复功能
This commit is contained in:
parent
0e46d0ac27
commit
48002eb247
|
@ -96,10 +96,13 @@ class SubDocumentCommentsController < ApplicationController
|
|||
end
|
||||
|
||||
def add_reply
|
||||
@document = OrgDocumentComment.find(params[:id]).root
|
||||
@document = SubDocumentComment.find(params[:id]).root
|
||||
@subdomain = @document.sub_domain
|
||||
@org_subfield = @subdomain.org_subfield
|
||||
@organization = @org_subfield.organization
|
||||
@act = OrgActivity.find(params[:id])
|
||||
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id])
|
||||
@comment.content = params[:org_content]
|
||||
@comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain, :creator_id => User.current.id, :reply_id => params[:id])
|
||||
@comment.content = params[:sub_content]
|
||||
@document.children << @comment
|
||||
@document.save
|
||||
end
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<% @documents.each do |document| %>
|
||||
<script>
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first.id %>, null, "100%", "OrgActivity");
|
||||
sd_create_editor_from_data(<%= OrgActivity.where("org_act_type='SubDocumentComment'and org_act_id=?", document.id).first.id %>, null, "100%", "OrgActivity");
|
||||
});
|
||||
</script>
|
||||
<%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<%= link_to User.find(document.creator_id), user_url_in_org(document.creator.id), :class => "newsBlue mr15" %>
|
||||
TO <%= link_to document.sub_domain.name, organization_path(@organization), :class => "newsBlue" %>
|
||||
|
|
||||
<span style="color:#269ac9;"><%=link_to document.sub_domain.name, org_subfield_sub_domain_sub_document_comment_path(document,:org_subfield_id=> @org_subfield.id, :sub_domain_id => document.sub_domain.id), :class => "newsBlue" %></span>
|
||||
<span style="color:#269ac9;"><%=link_to document.sub_domain.name, org_subfield_sub_domain_sub_document_comment_path(document, :org_subfield_id=> @org_subfield.id, :sub_domain_id => document.sub_domain.id), :class => "newsBlue" %></span>
|
||||
<%# if document.organization.home_id == document.id %>
|
||||
<!--<span class="red_homework_btn_cir ml5">已设为首页</span>-->
|
||||
<%# end %>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<div class="homepagePostDate fl">
|
||||
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
|
||||
</div>
|
||||
<div class="homepagePostDate fl ml15">
|
||||
<div class="homepagePostDate fl ml15" id="sub_document_update_time_<%= document.id %>">
|
||||
更新时间:<%= format_time(OrgActivity.where("org_act_type='#{document.class}' and org_act_id =#{document.id}").first.updated_at) %>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
|
@ -44,13 +44,13 @@
|
|||
<% comments_for_doc = document.children.reorder("created_at desc") %>
|
||||
<% count = document.children.count() %>
|
||||
|
||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">
|
||||
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="sub_document_comment_reply_<%= document.id %>">
|
||||
<div class="homepagePostReplyBanner">
|
||||
<div class="homepagePostReplyBannerCount">回复
|
||||
<sapn class="mr15"><%= count>0 ? "(#{count})" : "" %></sapn><span style="color: #cecece;">▪</span>
|
||||
<!--<span id="praise_count_<%#=document.id %>">-->
|
||||
<!--<%# if document.creator_id.to_i == User.current.id.to_i %>-->
|
||||
<!--<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(document) > 0 ? "(#{get_praise_num(document)})" : "" %></span></span>-->
|
||||
<!--<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%#= get_praise_num(document) > 0 ? "(#{get_praise_num(document)})" : "" %></span></span>-->
|
||||
<!--<%# else %>-->
|
||||
<!--<%#=render :partial=> "praise_tread/praise", :locals => {:activity=>document, :user_activity_id=>document.id,:type=>"activity"}%>-->
|
||||
<!--<%# end %>-->
|
||||
|
@ -98,10 +98,10 @@
|
|||
</div>
|
||||
<div class="homepagePostReplyInputContainer">
|
||||
<div nhname='new_message_<%= act.id %>' style="display:none;">
|
||||
<%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
|
||||
<%= form_for('new_form', :url => add_reply_org_subfield_sub_domain_sub_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
|
||||
<input type="hidden" name="org_activity_id" value="<%= act.id %>"/>
|
||||
<div nhname='toolbar_container_<%= act.id %>'></div>
|
||||
<textarea placeholder="有问题或建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= act.id %>' name="org_content"></textarea>
|
||||
<textarea placeholder="有问题或建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= act.id %>' name="sub_content"></textarea>
|
||||
<a id="new_message_submit_btn_<%= act.id %>" href="javascript:void(0)" class="blue_n_btn fr" style="display:none;margin-top:6px;line-height:18px;">发送</a>
|
||||
|
||||
<div class="cl"></div>
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => @document,:flag => params[:flag], :act => @act, :organization => @organization}) %>");
|
||||
sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>");
|
|
@ -9,11 +9,11 @@
|
|||
<%= render :partial => 'new' %>
|
||||
<% unless @documents.nil? %>
|
||||
<% @documents.each do |document| %>
|
||||
<!--<script>-->
|
||||
<!--// $(function() {-->
|
||||
<!--// sd_create_editor_from_data(<%#= OrgActivity.where("org_act_type='SubDocumentComment'and org_act_id=?", document.id).first.id %>, null, "100%", "OrgActivity");-->
|
||||
<!--// });-->
|
||||
<!--</script>-->
|
||||
<script>
|
||||
$(function() {
|
||||
sd_create_editor_from_data(<%= OrgActivity.where("org_act_type='SubDocumentComment'and org_act_id=?", document.id).first.id %>, null, "100%", "OrgActivity");
|
||||
});
|
||||
</script>
|
||||
<%= render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='SubDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -122,9 +122,10 @@ RedmineApp::Application.routes.draw do
|
|||
resources :sub_document_comments, :only => [:index, :new, :create, :show] do
|
||||
member do
|
||||
post 'add_reply'
|
||||
|
||||
get 'quote'
|
||||
post 'reply'
|
||||
|
||||
post 'add_reply_in_doc'
|
||||
delete 'delete_reply'
|
||||
end
|
||||
collection do
|
||||
|
||||
|
|
Loading…
Reference in New Issue