From 48002eb247e5a24ab7041ffab6b755d5b6038511 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 3 May 2016 19:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E7=9B=AE=E5=BD=95=E8=AE=A8?= =?UTF-8?q?=E8=AE=BA=E5=8C=BA=E6=B7=BB=E5=8A=A0=E5=B8=96=E5=AD=90=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/sub_document_comments_controller.rb | 9 ++++++--- app/views/org_document_comments/index.html.erb | 2 +- .../_show_sub_document.html.erb | 12 ++++++------ app/views/sub_document_comments/add_reply.js.erb | 2 ++ app/views/sub_document_comments/index.html.erb | 10 +++++----- config/routes.rb | 5 +++-- 6 files changed, 23 insertions(+), 17 deletions(-) create mode 100644 app/views/sub_document_comments/add_reply.js.erb diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb index c8cc29b63..db288306d 100644 --- a/app/controllers/sub_document_comments_controller.rb +++ b/app/controllers/sub_document_comments_controller.rb @@ -96,10 +96,13 @@ class SubDocumentCommentsController < ApplicationController end def add_reply - @document = OrgDocumentComment.find(params[:id]).root + @document = SubDocumentComment.find(params[:id]).root + @subdomain = @document.sub_domain + @org_subfield = @subdomain.org_subfield + @organization = @org_subfield.organization @act = OrgActivity.find(params[:id]) - @comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id]) - @comment.content = params[:org_content] + @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain, :creator_id => User.current.id, :reply_id => params[:id]) + @comment.content = params[:sub_content] @document.children << @comment @document.save end diff --git a/app/views/org_document_comments/index.html.erb b/app/views/org_document_comments/index.html.erb index 219a05194..0b8264d33 100644 --- a/app/views/org_document_comments/index.html.erb +++ b/app/views/org_document_comments/index.html.erb @@ -7,7 +7,7 @@ <% @documents.each do |document| %> <%= render :partial => 'organizations/show_org_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='OrgDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> diff --git a/app/views/sub_document_comments/_show_sub_document.html.erb b/app/views/sub_document_comments/_show_sub_document.html.erb index 0e5c9a2b0..b500f69a4 100644 --- a/app/views/sub_document_comments/_show_sub_document.html.erb +++ b/app/views/sub_document_comments/_show_sub_document.html.erb @@ -9,7 +9,7 @@ <%= link_to User.find(document.creator_id), user_url_in_org(document.creator.id), :class => "newsBlue mr15" %> TO  <%= link_to document.sub_domain.name, organization_path(@organization), :class => "newsBlue" %> | - <%=link_to document.sub_domain.name, org_subfield_sub_domain_sub_document_comment_path(document,:org_subfield_id=> @org_subfield.id, :sub_domain_id => document.sub_domain.id), :class => "newsBlue" %> + <%=link_to document.sub_domain.name, org_subfield_sub_domain_sub_document_comment_path(document, :org_subfield_id=> @org_subfield.id, :sub_domain_id => document.sub_domain.id), :class => "newsBlue" %> <%# if document.organization.home_id == document.id %> <%# end %> @@ -18,7 +18,7 @@
发布时间:<%= format_activity_day(document.created_at) %> <%= format_time(document.created_at, false) %>
-
+
更新时间:<%= format_time(OrgActivity.where("org_act_type='#{document.class}' and org_act_id =#{document.id}").first.updated_at) %>
@@ -44,13 +44,13 @@ <% comments_for_doc = document.children.reorder("created_at desc") %> <% count = document.children.count() %> -
+
回复 <%= count>0 ? "(#{count})" : "" %> - + @@ -98,10 +98,10 @@
- <%= form_for('new_form', :url => add_reply_org_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %> + <%= form_for('new_form', :url => add_reply_org_subfield_sub_domain_sub_document_comment_path(:id => document.id, :act_id => act.id, :flag => flag), :method => "post", :remote => true) do |f| %>
- +
diff --git a/app/views/sub_document_comments/add_reply.js.erb b/app/views/sub_document_comments/add_reply.js.erb new file mode 100644 index 000000000..bdc12d930 --- /dev/null +++ b/app/views/sub_document_comments/add_reply.js.erb @@ -0,0 +1,2 @@ +$("#organization_document_<%= @act.id %>").replaceWith("<%= escape_javascript(render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => @document,:flag => params[:flag], :act => @act, :organization => @organization}) %>"); +sd_create_editor_from_data(<%= @act.id %>,"","100%", "<%=@act.class.to_s%>"); diff --git a/app/views/sub_document_comments/index.html.erb b/app/views/sub_document_comments/index.html.erb index 7d598224b..9c48760fe 100644 --- a/app/views/sub_document_comments/index.html.erb +++ b/app/views/sub_document_comments/index.html.erb @@ -9,11 +9,11 @@ <%= render :partial => 'new' %> <% unless @documents.nil? %> <% @documents.each do |document| %> - - - - - + <%= render :partial => 'sub_document_comments/show_sub_document', :locals => {:document => document, :act => OrgActivity.where("org_act_type='SubDocumentComment'and org_act_id=?", document.id).first, :flag => 0} %> <% end %> <% end %> diff --git a/config/routes.rb b/config/routes.rb index 5905abd89..70e684966 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -122,9 +122,10 @@ RedmineApp::Application.routes.draw do resources :sub_document_comments, :only => [:index, :new, :create, :show] do member do post 'add_reply' - + get 'quote' post 'reply' - + post 'add_reply_in_doc' + delete 'delete_reply' end collection do