|
|
@ -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
|
|
|
|