二级域名讨论帖子添加删除链接

This commit is contained in:
huang 2016-05-05 16:43:20 +08:00
parent e0c011948c
commit 02d6186045
4 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,5 @@
class SubDocumentCommentsController < ApplicationController class SubDocumentCommentsController < ApplicationController
before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index] before_filter :find_subdomain_and_subfield, :only => [:new, :create, :show, :index, :destroy]
before_filter :find_subfield_content, :only => [:show, :index] before_filter :find_subfield_content, :only => [:show, :index]
helper :attachments,:organizations helper :attachments,:organizations
layout 'base_sub_domain' layout 'base_sub_domain'
@ -122,14 +122,13 @@ class SubDocumentCommentsController < ApplicationController
end end
def destroy def destroy
@sub_document_comment = OrgDocumentComment.find(params[:id]) @sub_document_comment = SubDocumentComment.find(params[:id])
org = @sub_document_comment.organization @sub_document_comment.destroy
if @sub_document_comment.id == org.home_id rescue ActiveRecord::RecordNotFound
org.update_attributes(:home_id => nil)
end
if @sub_document_comment.destroy
end
respond_to do |format| respond_to do |format|
# format.html{
# redirect_to org_subfield_sub_domain_sub_document_comments_path(:id => params[:sub_domain_id], :org_subfield_id => params[:org_subfield_id])
# }
format.js format.js
end end
end end

View File

@ -46,10 +46,10 @@
<!--<%# end %>--> <!--<%# end %>-->
<!--</li>--> <!--</li>-->
<li> <li>
<%#= 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 => flag), :method => 'edit', :class => "postOptionLink" %> <%= 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 => flag), :method => 'edit', :class => "postOptionLink" %>
</li> </li>
<li> <li>
<%#= 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 => flag), :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 => flag), :method => 'delete',
:data => {:confirm => l(:text_are_you_sure)}, :data => {:confirm => l(:text_are_you_sure)},
:remote => true, :class => 'postOptionLink' %> :remote => true, :class => 'postOptionLink' %>
</li> </li>

View File

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

View File

@ -119,7 +119,7 @@ RedmineApp::Application.routes.draw do
end end
resources :sub_domains, :only => [:index, :new, :create, :show, :update, :destroy] do resources :sub_domains, :only => [:index, :new, :create, :show, :update, :destroy] do
resources :sub_document_comments, :only => [:index, :new, :create, :show] do resources :sub_document_comments, :only => [:index, :new, :create, :show, :update, :destroy] do
member do member do
post 'add_reply' post 'add_reply'
get 'quote' get 'quote'