|
|
@ -65,25 +65,30 @@ class SubDocumentCommentsController < ApplicationController
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def update
|
|
|
|
def update
|
|
|
|
@org_document = OrgDocumentComment.find(params[:id])
|
|
|
|
@sub_document = SubDocumentComment.find(params[:id])
|
|
|
|
@org_document.update_attributes(:title => params[:org_document_comment][:title], :content => params[:org_document_comment][:content])
|
|
|
|
@sub_document.update_attributes(:title => params[:sub_document_comment][:title], :content => params[:sub_document_comment][:content])
|
|
|
|
Attachment.attach_files(@org_document, params[:attachments])
|
|
|
|
@organization = OrgSubfield.find(params[:org_subfield_id]).organization
|
|
|
|
|
|
|
|
# Attachment.attach_files(@org_document, params[:attachments])
|
|
|
|
# @org_document.save_attachments(params[:attachments])
|
|
|
|
# @org_document.save_attachments(params[:attachments])
|
|
|
|
if @org_document.parent.nil?
|
|
|
|
if @sub_document.parent.nil?
|
|
|
|
act = OrgActivity.where("org_act_type='OrgDocumentComment' and org_act_id =?", @org_document.id).first
|
|
|
|
act = OrgActivity.where("org_act_type='SubDocumentComment' and org_act_id =?", @sub_document.id).first
|
|
|
|
act.update_attributes(:updated_at => @org_document.updated_at)
|
|
|
|
act.update_attributes(:updated_at => @sub_document.updated_at)
|
|
|
|
EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document.id, :created_at => Time.now)
|
|
|
|
# EditorOfDocument.create(:editor_id => User.current.id, :org_document_comment_id => @org_document.id, :created_at => Time.now)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
respond_to do |format|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html {
|
|
|
|
format.html {
|
|
|
|
if params[:flag].to_i == 0
|
|
|
|
if params[:flag].to_i == 0
|
|
|
|
redirect_to organization_org_document_comments_path(:organization_id => @org_document.organization.id)
|
|
|
|
|
|
|
|
else
|
|
|
|
# render :action => 'index', :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'
|
|
|
|
if params[:flag].to_i == 1
|
|
|
|
redirect_to org_subfield_sub_domain_sub_document_comments_path(:org_subfield_id => params[:org_subfield_id], :sub_domain_id => params[:sub_domain_id])
|
|
|
|
redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
|
|
|
|
# render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'
|
|
|
|
|
|
|
|
# redirect_to organization_path(@organization)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
redirect_to organization_path(@org_document.organization.id, :org_subfield_id => params[:org_subfield_id])
|
|
|
|
# if params[:flag].to_i == 1
|
|
|
|
end
|
|
|
|
# redirect_to org_document_comment_path(@org_document.root.id, :organization_id => @org_document.organization.id)
|
|
|
|
|
|
|
|
# else
|
|
|
|
|
|
|
|
# redirect_to organization_path(@org_document.organization.id, :org_subfield_id => params[:org_subfield_id])
|
|
|
|
|
|
|
|
# end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -92,6 +97,7 @@ class SubDocumentCommentsController < ApplicationController
|
|
|
|
def edit
|
|
|
|
def edit
|
|
|
|
@sub_document = SubDocumentComment.find(params[:id])
|
|
|
|
@sub_document = SubDocumentComment.find(params[:id])
|
|
|
|
@flag = params[:flag]
|
|
|
|
@flag = params[:flag]
|
|
|
|
|
|
|
|
render :layout => @organization.switch_type ? 'base_sub_domain' : 'base_org'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def add_reply
|
|
|
|
def add_reply
|
|
|
|