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

210 lines
10 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">
2016-06-21 16:53:31 +08:00
<%= link_to @article.author.show_name, user_path(@article.author,:host=>Setting.host_user), :class => "linkBlue2", :target=> "_blank" %>
2015-10-24 15:34:43 +08:00
</div>
<div class="postDetailDate mb5"><%= format_time( @article.created_on)%></div>
<div class="cl"></div>
2016-07-14 14:44:47 +08:00
<%=render :partial =>"users/intro_content", :locals=>{:user_activity_id =>@article.id, :content=>@article.content} %>
2015-10-24 15:34:43 +08:00
<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>
2016-07-14 14:44:47 +08:00
<% all_comments = []%>
<% count=get_all_children(all_comments, @article).count %>
2015-10-24 15:34:43 +08:00
<div class="homepagePostReply">
2016-07-14 14:44:47 +08:00
<div class="homepagePostReplyBanner">
<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"} %>
2016-01-20 10:53:05 +08:00
</span>
2016-07-14 14:44:47 +08:00
</div>
<div class="homepagePostReplyBannerTime"></div>
</div>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @article) %>
<% if count > 0 %>
<div class="" id="reply_div_<%= @article.id %>">
<% comments.each do |comment| %>
2015-10-24 15:34:43 +08:00
<script type="text/javascript">
$(function(){
2016-07-14 14:44:47 +08:00
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
2015-10-24 15:34:43 +08:00
});
</script>
2016-07-14 14:44:47 +08:00
<li class="homepagePostReplyContainer" nhname="reply_rec">
2015-10-24 15:34:43 +08:00
<div class="homepagePostReplyPortrait">
2016-07-14 14:44:47 +08:00
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
2015-10-24 15:34:43 +08:00
</div>
<div class="homepagePostReplyDes" onmouseover="$('#delete_reply_<%=comment.id%>').show();" onmouseout="$('#delete_reply_<%=comment.id%>').hide();">
2016-07-21 10:30:48 +08:00
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
2016-07-14 14:44:47 +08:00
<% if !comment.content_detail.blank? %>
<div class="homepagePostReplyContent break_word list_style upload_img table_maxWidth" id="reply_content_<%= comment.id %>">
<%= comment.content_detail.html_safe %>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%=comment.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>comment, :user_activity_id=>comment.id,:type=>"reply"}%>
2016-05-25 16:19:41 +08:00
</span>
2016-07-14 14:44:47 +08:00
<span style="position: relative" class="fr mr20">
2015-10-24 15:34:43 +08:00
<%= link_to(
l(:button_reply),
2016-07-14 14:44:47 +08:00
{:controller => 'blog_comments', :action => 'quote', :user_id => comment.author_id, :blog_id => comment.blog_id, :id => comment.id},
2015-10-24 15:34:43 +08:00
:remote => true,
:method => 'get',
2016-07-14 14:44:47 +08:00
:title => l(:button_reply)) if !@article.locked? %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if comment.author == User.current %>
2015-10-24 15:34:43 +08:00
<%= link_to(
l(:button_delete),
2016-07-14 14:44:47 +08:00
{:controller => 'blog_comments', :action => 'destroy', :id => comment.id},
2015-10-24 15:34:43 +08:00
:method => :delete,
:id => "delete_reply_#{comment.id}",
:class => 'fr mr20 undis',
2015-10-24 15:34:43 +08:00
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
2016-07-14 14:44:47 +08:00
) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
2015-10-24 15:34:43 +08:00
</div>
<div class="cl"></div>
2016-07-14 14:44:47 +08:00
</li><% end %>
2015-10-24 15:34:43 +08:00
</div>
2016-07-14 14:44:47 +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>