二级域名讨论帖子添加删除链接
This commit is contained in:
parent
e0c011948c
commit
02d6186045
|
@ -1,5 +1,5 @@
|
|||
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]
|
||||
helper :attachments,:organizations
|
||||
layout 'base_sub_domain'
|
||||
|
@ -122,14 +122,13 @@ class SubDocumentCommentsController < ApplicationController
|
|||
end
|
||||
|
||||
def destroy
|
||||
@sub_document_comment = OrgDocumentComment.find(params[:id])
|
||||
org = @sub_document_comment.organization
|
||||
if @sub_document_comment.id == org.home_id
|
||||
org.update_attributes(:home_id => nil)
|
||||
end
|
||||
if @sub_document_comment.destroy
|
||||
end
|
||||
@sub_document_comment = SubDocumentComment.find(params[:id])
|
||||
@sub_document_comment.destroy
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
<!--<%# end %>-->
|
||||
<!--</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>
|
||||
<%#= 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)},
|
||||
:remote => true, :class => 'postOptionLink' %>
|
||||
</li>
|
||||
|
|
|
@ -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 %>
|
|
@ -119,7 +119,7 @@ RedmineApp::Application.routes.draw do
|
|||
end
|
||||
|
||||
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
|
||||
post 'add_reply'
|
||||
get 'quote'
|
||||
|
|
Loading…
Reference in New Issue