完成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 end
def add_reply_in_doc def add_reply_in_doc
@document = OrgDocumentComment.find(params[:id]).root @document = SubDocumentComment.find(params[:id]).root
@comment = OrgDocumentComment.new(:organization_id => @document.organization_id, :creator_id => User.current.id, :reply_id => params[:id]) @subdomain = @document.sub_domain
@comment.content = params[:org_comment][:org_content] @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.children << @comment
@document.save @document.save
respond_to do |format| 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
end end

View File

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

View File

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

View File

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