组织一级二级帖子删除文章问题

This commit is contained in:
yuanke 2016-05-20 22:07:33 +08:00
parent d4be470e5f
commit 76006ef3e7
5 changed files with 13 additions and 12 deletions

View File

@ -102,15 +102,14 @@ class OrgDocumentCommentsController < ApplicationController
end
def destroy
@org_document_comment = SubDocumentComment.find(params[:id])
@sub_domain = @org_document_comment.sub_domain
@org_subfield = @sub_domain.org_subfield
# org = @org_document_comment.organization
# if @org_document_comment.id == org.home_id
# org.update_attributes(:home_id => nil)
# end
@org_document_comment.destroy
# end
@org_document_comment = OrgDocumentComment.find(params[:id])
@org_sub_id = @org_document_comment.org_subfield_id
org = @org_document_comment.organization
if @org_document_comment.id == org.home_id
org.update_attributes(:home_id => nil)
end
if @org_document_comment.destroy
end
respond_to do |format|
format.js
end

View File

@ -125,6 +125,8 @@ class SubDocumentCommentsController < ApplicationController
def destroy
@sub_document_comment = SubDocumentComment.find(params[:id])
@sub_document_comment.destroy
@sub_domain = @sub_document_comment.sub_domain
@org_subfield = @sub_domain.org_subfield
rescue ActiveRecord::RecordNotFound
respond_to do |format|
# format.html{

View File

@ -1,6 +1,6 @@
//location.reload();
<% if params[:detail_page] %>
window.location.href = '<%= org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @sub_domain.id)%>';
window.location.href = '<%= organization_path(params[:organization_id],:org_subfield_id => @org_sub_id )%>';
<% else %>
window.location.reload();
<% end %>

View File

@ -1,6 +1,6 @@
//location.reload();
<% if params[:detail_page] %>
window.location.href = '<%= org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id)%>';
window.location.href = '<%= org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => @org_subfield.id, :sub_domain_id => @sub_domain.id)%>';
<% else %>
window.location.reload();
<% end %>

View File

@ -56,7 +56,7 @@
<%= link_to "编辑文章", edit_org_subfield_sub_domain_sub_document_comment_path(@document, :org_subfield_id=> params[:org_subfield_id], :sub_domain_id => @document.sub_domain.id, :flag => 1), :class => "postOptionLink" %>
</li>
<li>
<%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @organization.id, :detail_page => 1), :method => 'delete',
<%= link_to "删除文章", org_subfield_sub_domain_sub_document_comment_path(@document, :org_subfield_id=> params[:org_subfield_id], :sub_domain_id => @document.sub_domain.id, :flag => 0, :detail_page=>1), :method => 'delete',
:data => {:confirm => l(:text_are_you_sure)},
:remote => true, :class => 'postOptionLink' %>
</li>