From 39dd62580a5e13a661a5bc805773486eeb727d25 Mon Sep 17 00:00:00 2001 From: huang Date: Tue, 3 May 2016 20:08:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=902=E7=BA=A7=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sub_document_comments_controller.rb | 11 ++-- .../organizations/_org_subdomain.html.erb | 2 +- .../_show_newstyle.html.erb | 2 + app/views/sub_document_comments/show.html.erb | 53 ++++++++----------- 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/app/controllers/sub_document_comments_controller.rb b/app/controllers/sub_document_comments_controller.rb index a5f4ce125..ce1a54313 100644 --- a/app/controllers/sub_document_comments_controller.rb +++ b/app/controllers/sub_document_comments_controller.rb @@ -108,13 +108,16 @@ class SubDocumentCommentsController < ApplicationController end def add_reply_in_doc - @document = OrgDocumentComment.find(params[:id]).root - @comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id]) - @comment.content = params[:org_comment][:org_content] + @document = SubDocumentComment.find(params[:id]).root + @subdomain = @document.sub_domain + @org_subfield = @subdomain.org_subfield + @organization = @org_subfield.organization + @comment = SubDocumentComment.new(:sub_domain_id => @document.sub_domain_id, :creator_id => User.current.id, :reply_id => params[:id]) + @comment.content = params[:org_comment][:sub_content] @document.children << @comment @document.save respond_to do |format| - format.html {redirect_to org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id)} + format.html {redirect_to org_subfield_sub_domain_sub_document_comment_path(:id => @document.id, :org_subfield_id => @org_subfield.id, :sub_domain_id => @subdomain.id)} end end diff --git a/app/views/organizations/_org_subdomain.html.erb b/app/views/organizations/_org_subdomain.html.erb index ad5a9db57..4ed7c8d29 100644 --- a/app/views/organizations/_org_subdomain.html.erb +++ b/app/views/organizations/_org_subdomain.html.erb @@ -1,6 +1,6 @@ <% subdomains.each do |subdomain|%>
  • - <%= link_to subdomain.name, org_subfield_sub_domain_path(subdomain, :org_subfield_id => org_subfield_id), :class => "coursesLineGrey hidden", :title => subdomain.name %> + <%= link_to subdomain.name, org_subfield_sub_domain_sub_document_comments_path(subdomain, :org_subfield_id => org_subfield_id), :class => "coursesLineGrey hidden", :title => subdomain.name %>
  • <% end %> <% if subdomains.size == 5 %> diff --git a/app/views/sub_document_comments/_show_newstyle.html.erb b/app/views/sub_document_comments/_show_newstyle.html.erb index f607b370d..90d503bd1 100644 --- a/app/views/sub_document_comments/_show_newstyle.html.erb +++ b/app/views/sub_document_comments/_show_newstyle.html.erb @@ -13,6 +13,8 @@ + <% comments_for_doc = @document.children.reorder("created_at desc") %> + <% count = @document.children.count() %>

    留言板80条留言

    diff --git a/app/views/sub_document_comments/show.html.erb b/app/views/sub_document_comments/show.html.erb index 3119998e1..8f8ba1363 100644 --- a/app/views/sub_document_comments/show.html.erb +++ b/app/views/sub_document_comments/show.html.erb @@ -16,15 +16,15 @@
    <%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %> - TO  <%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %> + TO  <%= link_to @organization.name, organization_path(@organization), :class => "newsBlue" %> | - <% if @document.organization.home_id == @document.id %> - 首页 - <% else %> - 组织文章 - <% end %> + <%# if @organization.home_id == @document.id %> + + <%# else %> + + <%# end %>
    -
    <%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %>
    +
    <%= link_to @document.title %>
    发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %>
    <% unless @document.content.blank? %> @@ -33,27 +33,27 @@
    <% end %>
    - <%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %> + <%#= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %> <%#= link_to_attachments_course @document, :author => false %>
    - <% if User.current.admin? || User.current.admin_of_org?(Organization.find(@document.organization_id) || User.current.id == @document.creator_id) %> + <% if User.current.admin? || User.current.admin_of_org?(@organization) || User.current.id == @document.creator_id %>
      • - <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @document.organization_id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %> + <%= form_for('new_form', :url => {:controller => 'organizations', :action => 'set_homepage', :id => @organization.id, :home_id => @document.id}, :method => "put", :remote => true) do |f| %> 设为首页 <% end %>
      • - <%= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :flag => 1), :class => "postOptionLink" %> + <%#= link_to "编辑文章", edit_org_document_comment_path(:id => @document.id, :organization_id => @organization.id, :flag => 1), :class => "postOptionLink" %>
      • - <%= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @document.organization_id, :detail_page => 1), :method => 'delete', + <%#= link_to "删除文章", org_document_comment_path(:id => @document.id, :organization_id => @organization.id, :detail_page => 1), :method => 'delete', :data => {:confirm => l(:text_are_you_sure)}, :remote => true, :class => 'postOptionLink' %>
      • @@ -73,13 +73,13 @@
        回复 <%= count>0 ? "(#{count})" : "" %> - - <% if @document.creator_id.to_i == User.current.id.to_i %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%> - <% end %> - + + <%# if @document.creator_id.to_i == User.current.id.to_i %> + + <%# else %> + <%#=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%> + <%# end %> +
        @@ -101,22 +101,15 @@
        <%= format_time(reply.created_at) %> - - <% if reply.creator_id.to_i == User.current.id.to_i %> - - <% else %> - <%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%> - <% end %> -