完成2级目录详情页面

This commit is contained in:
huang 2016-05-03 20:08:40 +08:00
parent a9059c4c2e
commit 39dd62580a
4 changed files with 33 additions and 35 deletions

View File

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

View File

@ -1,6 +1,6 @@
<% subdomains.each do |subdomain|%>
<li class="homepageLeftMenuCoursesLine" style="position:relative;">
<%= 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 %>
</li>
<% end %>
<% if subdomains.size == 5 %>

View File

@ -13,6 +13,8 @@
</div>
</div>
<!--回复-->
<% comments_for_doc = @document.children.reorder("created_at desc") %>
<% count = @document.children.count() %>
<div class="sn-replybox">
<h2 class="sn-reply-h2">留言板<span class="sn-fr sn-f14 sn-font-grey3 sn-mt10">80条留言</span></h2>
<form class="sn-reply-form">

View File

@ -16,15 +16,15 @@
<div class="homepagePostDes">
<div class="homepagePostTo">
<%= link_to User.find(@document.creator_id), user_url_in_org(@document.creator_id), :class => "newsBlue mr15" %>
TO&nbsp;&nbsp;<%= link_to @document.organization.name, organization_path(@document.organization), :class => "newsBlue" %>
TO&nbsp;&nbsp;<%= link_to @organization.name, organization_path(@organization), :class => "newsBlue" %>
|
<% if @document.organization.home_id == @document.id %>
<span style="color:#269ac9;">首页</span>
<% else %>
<span style="color:#269ac9;">组织文章</span>
<% end %>
<%# if @organization.home_id == @document.id %>
<!--<span style="color:#269ac9;">首页</span>-->
<%# else %>
<!--<span style="color:#269ac9;">组织文章</span>-->
<%# end %>
</div>
<div class="homepagePostTitle postGrey"><%= link_to @document.title, org_document_comment_path(:id => @document.id, :organization_id => @document.organization.id) %></div>
<div class="homepagePostTitle postGrey"><%= link_to @document.title %></div>
<div class="homepagePostDate">
发布时间:<%= format_activity_day(@document.created_at) %> <%= format_time(@document.created_at, false) %></div>
<% unless @document.content.blank? %>
@ -33,27 +33,27 @@
</div>
<% end %>
<div class=" fl">
<%= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %>
<%#= render :partial=>"attachments/activity_attach", :locals=>{:activity => @document} %>
<%#= link_to_attachments_course @document, :author => false %>
</div>
<!-- <%# if defined?(home_id) %>
<div style="float:right;">最后编辑:<%#= User.find() %></div>
<%# end %>-->
<% 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 %>
<div class="homepagePostSetting">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= 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| %>
<a href="javascript:void(0);" class="postOptionLink" onclick="$(this).parent().submit();">设为首页</a>
<% end %>
</li>
<li>
<%= 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" %>
</li>
<li>
<%= 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' %>
</li>
@ -73,13 +73,13 @@
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@document.id %>">
<% if @document.creator_id.to_i == User.current.id.to_i %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(@document) > 0 ? "#{get_praise_num(@document)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%>
<% end %>
</span>
<!--<span id="praise_count_<%#=@document.id %>">-->
<%# if @document.creator_id.to_i == User.current.id.to_i %>
<!--<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%#= get_praise_num(@document) > 0 ? "#{get_praise_num(@document)}" : "" %></span></span>-->
<%# else %>
<%#=render :partial=> "praise_tread/praise", :locals => {:activity=>@document, :user_activity_id=>@document.id,:type=>"activity"}%>
<%# end %>
<!--</span>-->
</div>
</div>
<div class="" id="reply_div_<%= @document.id %>">
@ -101,22 +101,15 @@
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_at) %>
<span id="reply_praise_count_<%=reply.id %>">
<% if reply.creator_id.to_i == User.current.id.to_i %>
<span class="fr likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(reply) > 0 ? "#{get_praise_num(reply)}" : "" %></span></span>
<% else %>
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
<% end %>
</span>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<%= link_to(
<%#= link_to(
l(:button_reply),
{:controller => 'org_document_comments',:action => 'quote',:user_id=>reply.creator_id, :id => reply.id},
:remote => true,
:method => 'get',
:class => 'fr newsBlue mr10',
:title => l(:button_reply)) if User.current.logged? %>
<%= link_to(
<%#= link_to(
l(:button_delete),
{:controller => 'org_document_comments',:action => 'delete_reply', :id => reply.id},
:method => :delete,
@ -139,8 +132,8 @@
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @document.id %>">
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'org_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= f.kindeditor :org_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
<%= form_for :org_comment, :url => {:action => 'add_reply_in_doc',:controller => 'sub_document_comments', :id => @document.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= f.kindeditor :sub_content,:width=>'99%',:height => '100px;',:editor_id=>'message_content_editor' %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
<%= link_to l(:button_reply), "javascript:void(0)", :onclick => "message_content_editor.sync();$('#message_form').submit();", :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %>
<% end %>