socialforge/app/views/blog_comments/show.html.erb

217 lines
11 KiB
Plaintext
Raw Normal View History

2015-12-06 15:03:36 +08:00
<%= content_for(:header_tags) do %>
<%= import_ke(enable_at: false, prettify: false) %>
<%#= javascript_include_tag "init_activity_KindEditor",'blog' %>
2016-02-01 14:50:45 +08:00
<%= javascript_include_tag "create_kindeditor",'blog' %>
2015-12-06 15:03:36 +08:00
<% end %>
2015-10-24 15:34:43 +08:00
<script type="text/javascript">
$(function(){
$("#RSide").removeAttr("id");
$("#Container").css("width","1000px");
});
</script>
<script>
function expand_reply(container,btnid){
var target = $(container).children();
var btn = $(btnid);
if(btn.data('init')=='0'){
btn.data('init',1);
btn.html('收起回复');
target.show();
}else{
btn.data('init',0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
$(function() {
2016-01-29 16:55:07 +08:00
sd_create_editor_from_data(<%= @article.id%>,null,"100%", '<%=@article.class.to_s%>');
2015-10-24 15:34:43 +08:00
showNormalImage('message_description_<%= @article.id %>');
});
</script>
2015-11-11 17:16:19 +08:00
<div class="postRightContainer" onmouseover="$('#message_setting_<%= @article.id%>').show();" onmouseout="$('#message_setting_<%= @article.id%>').hide();">
2015-10-24 15:34:43 +08:00
<div class="postThemeContainer">
<div class="postDetailPortrait">
<%= link_to image_tag(url_to_avatar(@article.author),:width=>50,:height => 50,:alt=>'图像' ),user_path(@article.author) %>
</div>
<div class="postThemeWrap">
<% if @article.author.id == User.current.id || User.current.admin? %>
2015-10-24 15:34:43 +08:00
<div class="homepagePostSetting" id="message_setting_<%= @article.id%>" style="display: none">
<ul>
<li class="homepagePostSettingIcon">
<ul class="homepagePostSettiongText">
<li>
<%= link_to(
l(:button_edit),
{:action => 'edit', :id => @article.id,:in_act => params[:in_act]},
2015-10-24 15:34:43 +08:00
:class => 'postOptionLink'
) if User.current.admin? || User.current.id == @article.author.id %>
2015-10-24 15:34:43 +08:00
</li>
<li>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => @article.id},
:method => :delete,
:data => {:confirm => l(:text_are_you_sure)},
:class => 'postOptionLink'
) if User.current.admin? || User.current.id == @article.author.id %>
2015-10-24 15:34:43 +08:00
</li>
<li>
<% if @article.id == @article.blog.homepage_id %>
<%= link_to(
l(:button_cancel_homepage),
{:controller => 'blogs',:action => 'cancel_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
:method => :post,
:class => 'postOptionLink'
) if User.current && User.current.id == @article.blog.author_id %>
<% else %>
<%= link_to(
l(:button_set_homepage),
{:controller => 'blogs',:action => 'set_homepage',:user_id=>@article.author_id,:id=>@article.blog_id, :article_id => @article.id},
:method => :post,
:class => 'postOptionLink'
) if User.current && User.current.id == @article.blog.author_id %>
<% end %>
</li>
2015-10-24 15:34:43 +08:00
</ul>
</li>
</ul>
</div>
<%end%>
<div class="postDetailTitle fl">
<a href="javascript:void(0);" class="f14 linkGrey4 fb" style="overflow:hidden;">主题: <%= @article.title%></a>
</div>
<div class="cl"></div>
<div class="postDetailCreater">
<% if @article.try(:author).try(:realname) == ' ' %>
<%= link_to @article.try(:author), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% else %>
<%= link_to @article.try(:author).try(:realname), user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
<% end %>
</div>
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
<div class="homepagePostIntro memo-content upload_img break_word" id="message_description_<%= @article.id %>" style="word-break: break-all; word-wrap:break-word;margin-bottom: 0px !important;" >
2015-10-24 15:34:43 +08:00
<%= @article.content.html_safe%>
</div>
<div class="cl"></div>
<div class=" fl" style="width: 600px">
<%#= link_to_attachments_course @topic, :author => false %>
<% if @article.attachments.any?%>
<% options = {:author => true, :deletable => false} %>
2015-10-24 15:34:43 +08:00
<%= render :partial => 'blog_comments/attachments_links', :locals => {:attachments => @article.attachments, :options => options, :is_float => true} %>
<% end %>
</div>
</div>
<div class="cl"></div>
</div>
<div class="cl"></div>
<% count=0 %>
<% if @article.parent %>
<% count=@article.parent.children.count%>
<% else %>
<% count=@article.children.count%>
<% end %>
<div class="homepagePostReply">
2016-01-20 10:53:05 +08:00
<%# unless count == 0 %>
2015-10-24 15:34:43 +08:00
<div class="homepagePostReplyBanner">
2016-01-20 10:53:05 +08:00
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=@article.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>@article, :user_activity_id=>@article.id,:type=>"activity"}%>
</span>
</div>
2015-10-24 15:34:43 +08:00
<div class="homepagePostReplyBannerTime"></div>
<!-- <div class="homepagePostReplyBannerMore">
<%# if @reply_count > 2%>
<a href="javascript:void(0);" class="replyGrey" id="reply_btn_<%#= @topic.id%>" onclick="expand_reply('#reply_div_<%#= @topic.id %>','#reply_btn_<%#= @topic.id%>')" data-count="<%#= @reply_count %>" data-init="0" >点击展开更多回复</a>
<%# end %>
</div>-->
</div>
<div class="" id="reply_div_<%= @article.id %>">
<%@article.children.reorder('created_on desc').each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
autoUrl('reply_message_description_<%= reply.id %>');
2015-10-24 15:34:43 +08:00
});
</script>
<div class="homepagePostReplyContainer" onmouseover="$('#reply_edit_menu_<%= reply.id%>').show();" onmouseout="$('#reply_edit_menu_<%= reply.id%>').hide();">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(reply.author), :width => 33,:height => 33), user_path(reply.author) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<% if reply.try(:author).try(:realname) == ' ' %>
<%= link_to reply.try(:author), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% else %>
<%= link_to reply.try(:author).try(:realname), user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<% end %>
</div>
<div class="homepagePostReplyContent upload_img break_word" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
2016-01-20 10:53:05 +08:00
<span id="reply_praise_count_<%=reply.id %>">
2016-05-25 16:19:41 +08:00
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
2016-01-20 10:53:05 +08:00
<div class="fr mr10" id="reply_edit_menu_<%= reply.id%>" style="display: none">
2015-10-24 15:34:43 +08:00
<%= link_to(
l(:button_reply),
{:controller => 'blog_comments',:action => 'quote',:user_id=>reply.author_id,:blog_id=>reply.blog_id, :id => reply.id},
:remote => true,
:method => 'get',
:class => 'fr newsBlue',
:title => l(:button_reply)) if !@article.locked? && User.current.logged? %>
<%= link_to(
l(:button_delete),
{:controller => 'blog_comments',:action => 'destroy', :id => reply.id},
:method => :delete,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.author.id == User.current.id %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
2016-01-20 10:53:05 +08:00
<%# end %>
2015-10-24 15:34:43 +08:00
<div class="cl"></div>
<% if !@article.locked? && User.current.logged?%>
<div class="talkWrapMsg" nhname="about_talk_reply">
<em class="talkWrapArrow"></em>
<div class="cl"></div>
<div class="talkConIpt ml5 mb10" id="reply<%= @article.id %>">
<%= form_for :blog_comment, :url => {:action => 'reply',:controller => 'blog_comments',:user_id=>@article.author.id,:blog_id=>@article.blog_id, :id => @article.id}, :html => {:multipart => true, :id => 'message_form'} do |f| %>
<%= render :partial => 'blog_comments/reply_form', :locals => {:f => f,:user=>@user,:article=>@article} %>
<%= link_to l(:button_cancel), "javascript:void(0)", :onclick => 'message_content_editor.html("");', :class => " grey_btn fr c_white mt10 mr5" %>
2015-11-11 17:16:19 +08:00
<%= link_to l(:button_submit), "javascript:void(0)", :onclick => 'submit_message_replay();', :class => "blue_btn fr c_white mt10 mb10", :style => "margin-right: 5px;" %>
2015-10-24 15:34:43 +08:00
<% end %>
<div class="cl"></div>
</div>
</div>
<% end %>
</div>
</div>
<script type="text/javascript">
$(function(){
var postContent = $("#message_description_<%= @article.id %>").html();
postContent = postContent.replace(/&nbsp;/g," ");
postContent= postContent.replace(/ {2}/g,"&nbsp; ");
postContent=postContent.replace(/&nbsp; &nbsp;/g,"&nbsp;&nbsp;&nbsp;");
postContent=postContent.replace(/&nbsp; /g,"&nbsp;&nbsp; ");
$("#message_description_<%= @article.id %>").html(postContent);
autoUrl('message_description_<%= @article.id %>');
});
2016-01-22 20:55:18 +08:00
</script>