From d4be470e5fff724846cc0b597904ead38e5c5cf5 Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Fri, 20 May 2016 20:08:46 +0800 Subject: [PATCH] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E4=BA=8C=E7=BA=A7=E5=B8=96?= =?UTF-8?q?=E5=AD=90=E6=96=87=E7=AB=A0=E5=9B=9E=E5=A4=8D=E4=B8=8D=E4=BA=86?= =?UTF-8?q?=202.=E7=BB=84=E7=BB=87=E4=BA=8C=E7=BA=A7=E5=B8=96=E5=AD=90?= =?UTF-8?q?=E6=96=87=E7=AB=A0=E7=82=B9=E8=BF=9B=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E5=88=A0=E9=99=A4=E4=B8=8D=E4=BA=86=E6=96=87=E7=AB=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/at_controller.rb | 2 +- .../org_document_comments_controller.rb | 16 +++++++++------- app/views/org_document_comments/destroy.js.erb | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/controllers/at_controller.rb b/app/controllers/at_controller.rb index fe16385f4..5b29565ad 100644 --- a/app/controllers/at_controller.rb +++ b/app/controllers/at_controller.rb @@ -68,7 +68,7 @@ class AtController < ApplicationController end def find_project(id) - return [] if id<0 + return [] if id.to_i<0 at_persons = Project.find(id).users at_persons.delete_if { |u| u.id == User.current.id } end diff --git a/app/controllers/org_document_comments_controller.rb b/app/controllers/org_document_comments_controller.rb index c6047d227..02e74237a 100644 --- a/app/controllers/org_document_comments_controller.rb +++ b/app/controllers/org_document_comments_controller.rb @@ -102,13 +102,15 @@ class OrgDocumentCommentsController < ApplicationController end def destroy - @org_document_comment = OrgDocumentComment.find(params[: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 + @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 respond_to do |format| format.js end diff --git a/app/views/org_document_comments/destroy.js.erb b/app/views/org_document_comments/destroy.js.erb index 787bd3185..1e830d7bc 100644 --- a/app/views/org_document_comments/destroy.js.erb +++ b/app/views/org_document_comments/destroy.js.erb @@ -1,6 +1,6 @@ //location.reload(); <% if params[:detail_page] %> - window.location.href = '<%= organization_org_document_comments_path(:organization_id => @org_document_comment.root.organization_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 %> \ No newline at end of file