课程讨论区、项目讨论区、帖子详情页面的二级回复

This commit is contained in:
cxt 2016-07-04 14:14:51 +08:00
parent b1a77a036b
commit cc649ae64b
20 changed files with 382 additions and 145 deletions

View File

@ -44,7 +44,8 @@ class MessagesController < ApplicationController
offset = @topic.children.count(:conditions => ["#{Message.table_name}.id < ?", params[:r].to_i])
page = 1 + offset / REPLIES_PER_PAGE
end
@reply_count = @topic.children.count
all_comments = []
@reply_count = get_all_children(all_comments, @topic).count
@reply = Message.new(:subject => "RE: #{@message.subject}")
if @course
messages_replies = @topic.children.
@ -137,26 +138,32 @@ class MessagesController < ApplicationController
# Reply to a topic
def reply
if params[:reply][:content] == ""
if params[:is_board]
if @project
(redirect_to project_boards_path(@project), :notice => l(:label_reply_empty);return)
elsif @course
(redirect_to course_boards_path(@course), :notice => l(:label_reply_empty);return)
end
else
(redirect_to board_message_url(@board, @topic, :r => @reply), :notice => l(:label_reply_empty);return)
end
if params[:parent_id]
parent = Message.find params[:parent_id]
@reply = Message.new
@reply.author = User.current
@reply.board = parent.board
@reply.content = params[:content]
@reply.subject = "RE: #{parent.subject}"
@reply.reply_id = params[:reply_id]
# @reply.reply_id = params[:id]
parent.children << @reply
@topic = params[:activity_id].nil? ? parent : Message.find(params[:activity_id].to_i)
@user_activity_id = params[:user_activity_id] if params[:user_activity_id]
@is_course = params[:is_course] if params[:is_course]
@is_board = params[:is_board] if params[:is_board]
else
@quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
@topic.children << @reply
# @reply.reply_id = params[:id]
end
@quote = params[:quote][:quote]
@reply = Message.new
@reply.author = User.current
@reply.board = @board
@reply.safe_attributes = params[:reply]
@reply.content = @quote + @reply.content
@reply.subject = "RE: #{@topic.subject}" unless params[:reply][:subject]
# @reply.reply_id = params[:id]
@topic.children << @reply
update_course_activity(@topic.class,@topic.id)
update_user_activity(@topic.class,@topic.id)
update_forge_activity(@topic.class,@topic.id)
@ -182,14 +189,10 @@ class MessagesController < ApplicationController
respond_to do |format|
format.js
end
elsif params[:is_board]
if @project
redirect_to project_boards_path(@project)
elsif @course
redirect_to course_boards_path(@course)
end
return
else
redirect_to board_message_url(@board, @topic, :r => @reply)
redirect_to board_message_url(@board, @topic)
return
end
end
@ -251,6 +254,17 @@ class MessagesController < ApplicationController
# Delete a messages
def destroy
if params[:user_activity_id]
@message.destroy
@topic = Message.find(params[:activity_id].to_i)
@user_activity_id = params[:user_activity_id]
@is_course = params[:is_course]
@is_board = params[:is_board]
respond_to do |format|
format.js
end
return
end
if @project
(render_403; return false) unless @message.destroyable_by?(User.current)
elsif @course
@ -299,12 +313,12 @@ class MessagesController < ApplicationController
end
def quote
@subject = @message.subject
@subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
@content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
@temp = Message.new
@temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @message.author.show_name)} <br/>#{@message.content.html_safe}</blockquote>".html_safe
# @subject = @message.subject
# @subject = "RE: #{@subject}" unless @subject.starts_with?('RE:')
#
# @content = "> #{ll(Setting.default_language, :text_user_wrote, @message.author)}\n> "
# @temp = Message.new
# @temp.content = "<blockquote>#{ll(Setting.default_language, :text_user_wrote, @message.author.show_name)} <br/>#{@message.content.html_safe}</blockquote>".html_safe
end
def preview

View File

@ -90,6 +90,8 @@ class UsersController < ApplicationController
case params[:type]
when 'JournalsForMessage'
@comment = JournalsForMessage.find params[:comment].to_i
when 'Message'
@comment = Message.find params[:comment].to_i
end
end
@ -111,6 +113,13 @@ class UsersController < ApplicationController
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@type = 'JournalsForMessage'
when 'Message'
@reply = Message.find params[:reply_id]
@user_activity_id = params[:user_activity_id]
@activity_id = params[:activity_id]
@is_course = params[:is_course]
@is_board = params[:is_board]
@type = 'Message'
end
respond_to do |format|
format.js
@ -3281,7 +3290,12 @@ class UsersController < ApplicationController
@journals = obj.children.reorder("created_at desc")
when 'Message'
obj = Message.where('id = ?', params[:id].to_i).first
@journals = obj.children.reorder("created_on desc")
@type = 'Message'
@is_course = params[:is_course]
@is_board = params[:is_board]
@user_activity_id = params[:div_id].to_i if params[:div_id]
comments = []
@journals = get_all_children(comments, obj)
when 'News'
obj = News.where('id = ?', params[:id].to_i).first
@journals = obj.comments.reorder("created_on desc")

View File

@ -3138,9 +3138,9 @@ def get_reply_parents_no_root parents_rely, comment
parents_rely
end
#获取留言的所有子节点
#获取所有子节点
def get_all_children result, jour
if jour.kind_of? JournalsForMessage
if (jour.kind_of? JournalsForMessage) || (jour.kind_of? Message)
jour.children.each do |jour_child|
result << jour_child
get_all_children result, jour_child

View File

@ -95,9 +95,10 @@
</span>
</div>
</div>
<% unless @replies.empty? %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @topic) %>
<div class="" id="reply_div_<%= @topic.id %>">
<% @replies.each_with_index do |reply,i| %>
<% comments.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
@ -110,32 +111,41 @@
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%= link_to reply.author.show_name, user_path(reply.author_id,:host=>Setting.host_user), :class => "newsBlue mr10 f14" %>
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(reply.created_on) %>
</div>
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<% end %>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%= reply.id %>">
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:class => 'fr newsBlue mr10',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<span id="reply_iconup_<%= reply.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr newsGrey mr10',
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
@ -145,7 +155,6 @@
<% end %>
</div>
<% end %>
<div class="cl"></div>
<% if !@topic.locked? && authorize_for_course('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply">

View File

@ -156,61 +156,65 @@
</span>
</div>
</div>
<% unless @replies.empty? %>
<div class="" id="reply_div_<%= @topic.id %>">
<% @replies.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
autoUrl('reply_message_description_<%= reply.id %>');
});
</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 table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div style="margin-top: -7px; margin-bottom: 5px">
<%= format_time(reply.created_on) %>
<div class="fr" id="reply_edit_menu_<%= reply.id%>" style="display: none">
<span id="reply_praise_count_<%=reply.id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>reply, :user_activity_id=>reply.id,:type=>"reply"}%>
</span>
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:class => 'fr newsBlue mr10',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr newsGrey mr10',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.destroyable_by?(User.current) %>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @topic) %>
<div class="" id="reply_div_<%= @topic.id %>">
<% comments.each_with_index do |reply,i| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_message_description_<%= reply.id %>');
autoUrl('reply_message_description_<%= reply.id %>');
});
</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">
<%= link_to reply.creator_user.show_name, user_url_in_org(reply.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(reply.created_on) %>
</div>
<% end %>
</div>
<% if !reply.parent.nil? && !reply.parent.parent.nil? %>
<%= render :partial => 'users/message_contents', :locals => {:comment => reply}%>
<% end %>
<div class="homepagePostReplyContent upload_img break_word table_maxWidth" id="reply_message_description_<%= reply.id %>">
<%= reply.content.html_safe%>
</div>
<div class="orig_reply mb10 mt-10">
<div class="reply">
<span class="reply-right">
<span id="reply_praise_count_<%= reply.id %>">
<%= render :partial => "praise_tread/praise", :locals => {:activity => reply, :user_activity_id => reply.id, :type => "reply"} %>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:action => 'quote', :id => reply},
:remote => true,
:method => 'get',
:title => l(:button_reply)) if !@topic.locked? && authorize_for('messages', 'reply') %>
<span id="reply_iconup_<%= reply.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<%= link_to(
l(:button_delete),
{:action => 'destroy', :id => reply},
:method => :post,
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) if reply.course_destroyable_by?(User.current) %>
</span>
<% end %>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= reply.id%>"></p>
</div>
<div class="cl"></div>
</div>
<% end %>
</div>
<div class="cl"></div>
<% if !@topic.locked? && authorize_for('messages', 'reply') %>
<div class="talkWrapMsg" nhname="about_talk_reply">

View File

@ -4,11 +4,12 @@
<div class="ReplyToMessageInputContainer mb10">
<% if User.current.logged? %>
<div nhname='new_message_<%= reply.id%>'>
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :html => {:multipart => true, :id => 'new_form'} do |f| %>
<input type="hidden" name="quote[quote]" id="quote_quote">
<input type="hidden" name="reply[subject]" id="reply_subject">
<%= form_for @reply, :as => :reply, :url => {:action => 'reply', :id => @topic}, :method => "post", :id => 'new_form' do |f| %>
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
<%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %>
<%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@topic.id %>
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply[content]"></textarea>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="content"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>

View File

@ -0,0 +1,8 @@
<%if @project%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/project_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<%elsif @course%>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'users/course_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id,:is_course=>@is_course,:is_board=>@is_board}) %>");
<% elsif @org_subfield %>
$("#user_activity_<%= @user_activity_id%>").replaceWith("<%= escape_javascript(render :partial => 'organizations/org_subfield_message', :locals => {:activity => @topic,:user_activity_id =>@user_activity_id}) %>");
<%end%>
sd_create_editor_from_data(<%= @user_activity_id %>,"","100%", "UserActivity");

View File

@ -1,16 +1,8 @@
/*$('#message_subject').val("<%#= raw escape_javascript(@subject) %>");
$('#message_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
//$('#message_content').val("<#%= raw escape_javascript(@content) %>");
$('#quote_quote').html("<%#= raw escape_javascript(@temp.content.html_safe) %>");
showAndScrollTo("reply", "message_content");
$('#message_content').scrollTop = $('#message_content').scrollHeight - $('#message_content').clientHeight;
$("img").removeAttr("align");*/
if($("#reply_message_<%= @message.id%>").length > 0) {
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message,:temp =>@temp,:subject =>@subject}) %>");
$("#reply_message_<%= @message.id%>").replaceWith("<%= escape_javascript(render :partial => 'reply_message', :locals => {:reply => @message}) %>");
$(function(){
$('#reply_subject').val("<%= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%= raw escape_javascript(@temp.content.html_safe) %>");
/*$('#reply_subject').val("<%#= raw escape_javascript(@subject) %>");
$('#quote_quote').val("<%#= raw escape_javascript(@temp.content.html_safe) %>");*/
sd_create_editor_from_data(<%= @message.id%>,null,"100%", "<%=@message.class.to_s%>");
});
}else if($("#reply_to_message_<%= @message.id%>").length >0) {

View File

@ -1,9 +1,9 @@
<div class="orig_user fl">
<%= link_to image_tag(url_to_avatar(comment.user), :width => "33", :height => "33"), user_path(comment.user_id), :alt => "用户头像" %>
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => "33", :height => "33"), user_path(comment.creator_user.id), :alt => "用户头像" %>
</div>
<div class="orig_right fl">
<%= link_to comment.user.show_name, user_path(comment.user_id), :class => "content-username" %>
<%= link_to comment.creator_user.show_name, user_path(comment.creator_user.id), :class => "content-username" %>
<span class="orig_area"><%= time_from_now(comment.created_on) %></span>
<div class="orig_content "><%= comment.notes.html_safe %></div>
<div class="orig_content "><%= comment.content_detail.html_safe %></div>
</div>
<div class="cl"></div>

View File

@ -78,20 +78,18 @@
</div>
<div class="cl"></div>
</div>
<% count=0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
<%# count = fetch_user_leaveWord_reply(activity).count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>
<% activity= activity.parent ? activity.parent : activity%>
<% comments = activity.children.reorder("created_on desc").limit(3) %>
<% if count > 0 %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => is_course, :is_board =>is_board}%>
</div>
<% end %>

View File

@ -0,0 +1,23 @@
<% parents_rely = [] %>
<% parents_rely = get_reply_parents_no_root parents_rely, comment %>
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<% if length <= 3 %>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => comment.parent} %>
<% else %>
<div class="orig_cont clearfix">
<div class="orig_cont clearfix">
<div>
<%=render :partial => 'users/journal_comment_reply', :locals => {:comment => parents_rely[length - 1]} %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[length - 2]} %>
</div>
<div class="orig_cont_hide clearfix">
<span class="orig_icon" >&darr; </span>
<span class="orig_icon" style="display:none;" > &uarr;</span>
<%= link_to '点击展开隐藏楼层', show_all_replies_users_path(:comment => comment, :type => comment.class),:remote=>true %>
</div>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => parents_rely[0]} %>
</div>
<% end %>
</div>

View File

@ -0,0 +1,61 @@
<ul>
<% comments.each do |comment| %>
<script type="text/javascript">
$(function(){
showNormalImage('reply_content_<%= comment.id %>');
autoUrl('reply_content_<%= comment.id %>');
});
</script>
<li class="homepagePostReplyContainer" nhname="reply_rec">
<div class="homepagePostReplyPortrait">
<%= link_to image_tag(url_to_avatar(comment.creator_user), :width => 33, :height => 33, :alt => "用户头像"), user_url_in_org(comment.creator_user.id) %>
</div>
<div class="homepagePostReplyDes">
<div class="homepagePostReplyPublisher">
<%= link_to comment.creator_user.show_name, user_url_in_org(comment.creator_user.id), :class => "newsBlue mr10 f14" %>
<%= time_from_now(comment.created_on) %>
</div>
<% if !comment.parent.nil? && !comment.parent.parent.nil? %>
<%= render :partial => 'users/message_contents', :locals => {:comment => comment}%>
<% end %>
<% 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"}%>
</span>
<span style="position: relative" class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
<span id="reply_iconup_<%=comment.id %>" class="reply_iconup02" style="display: none"> ︿</span>
</span>
<% if comment.course_destroyable_by?(User.current) %>
<%= link_to(
l(:button_delete),
delete_board_message_path(comment,:board_id =>comment.board.id, :user_activity_id => user_activity_id, :activity_id => activity_id, :is_course => is_course, :is_board => is_board),
:method => :post,
:remote => true,
:class => 'fr mr20',
:data => {:confirm => l(:text_are_you_sure)},
:title => l(:button_delete)
) %>
<% end %>
</span>
<div class="cl"></div>
</div>
</div>
<p id="reply_message_<%= comment.id%>"></p>
<% end %>
</div>
<div class="cl"></div>
</li>
<% end %>
</ul>

View File

@ -0,0 +1,18 @@
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">
<span>回复</span>
<span class="reply_iconup" > ︿</span>
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">▪</span>
<span id="praise_count_<%=user_activity_id %>">
<%=render :partial=> "praise_tread/praise", :locals => {:activity=>activity, :user_activity_id=>user_activity_id,:type=>"activity"}%>
</span>
</div>
<div class="homepagePostReplyBannerTime"><%#= format_date(activity.updated_on) %></div>
<%if count>3 %>
<div class="homepagePostReplyBannerMore">
<a id="reply_btn_<%=user_activity_id%>" onclick="expand_message_reply('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'<%=activity.class %>',<%=user_activity_id %>,<%=is_course %>,<%=is_board %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
</div>
<% end %>
</div>

View File

@ -77,20 +77,18 @@
</div>
<div class="cl"></div>
</div>
<% count = 0 %>
<% if activity.parent %>
<% count=activity.parent.children.count%>
<% else %>
<% count=activity.children.count%>
<% end %>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<%# allow_delete = (activity.user == User.current || User.current.admin? || User.current.allowed_to?(:as_teacher,activity.course)) %>
<%# count = fetch_user_leaveWord_reply(activity).count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<%= render :partial => 'users/message_reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>
<% activity= activity.parent_id.nil? ? activity : activity.parent %>
<% comments = activity.children.reorder("created_on desc").limit(3) %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/all_replies', :locals => {:comments => comments}%>
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => is_course, :is_board =>is_board}%>
</div>
<% end %>

View File

@ -16,7 +16,7 @@
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
<% elsif @type == 'JournalsForMessage' %>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => reply.id}, :method => "post", :remote => true) do |f|%>
<%= form_for('new_form',:url => {:controller => 'words', :action => 'create_reply', :id => reply.id}, :method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'reference_id', params[:reference_id], :value => reply.id %>
<%= hidden_field_tag 'reference_user_id', params[:reference_user_id], :value => reply.user.id %>
<%= hidden_field_tag 'reference_message_id', params[:reference_message_id], :value => reply.id %>
@ -28,6 +28,22 @@
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<% end%>
<% elsif @type == 'Message' %>
<%= form_for('new_form',:url => {:controller => 'messages', :action => 'reply', :id => reply.id, :board_id => reply.board.id}, :method => "post", :remote => true) do |f|%>
<%= hidden_field_tag 'is_course', params[:is_course], :value => @is_course %>
<%= hidden_field_tag 'is_board', params[:is_board], :value => @is_board %>
<%= hidden_field_tag 'parent_id', params[:parent_id], :value => reply.id %>
<%= hidden_field_tag 'reply_id', params[:reply_id], :value => reply.author.id %>
<%= hidden_field_tag 'activity_id',params[:activity_id],:value =>@activity_id %>
<%= hidden_field_tag 'user_activity_id',params[:user_activity_id],:value =>@user_activity_id %>
<!--<input type="hidden" name="quote[quote]" id="quote_quote">
<input type="hidden" name="reply[subject]" id="reply_subject">-->
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="content"></textarea>
<a id="new_message_submit_btn_<%= reply.id%>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>
<% end %>
</div>
<div class="cl"></div>

View File

@ -2,6 +2,8 @@
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/homework_replies', :locals => {:comments => @journals, :is_in_course =>@is_in_course,:course_activity=>@course_activity, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id}) %>');
<% elsif params[:type] == 'JournalsForMessage' %>
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/journal_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :allow_delete => @allow_delete, :activity_id =>params[:id].to_i}) %>');
<% elsif params[:type] == 'Message' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id =>params[:id].to_i,:is_course => @is_course, :is_board => @is_board}) %>');
<% else %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/all_replies', :locals => {:comments => @journals}) %>');
<% end %>

View File

@ -1,6 +1,8 @@
<% unless @comment.parent.nil? %>
<% if params[:type] == 'JournalsForMessage' && (@comment.jour_type == 'Principal' || @comment.jour_type == 'Course') %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>");
<% elsif @comment.class.to_s == 'Message' %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/journal_comment_reply', :locals => {:comment => @comment.parent})%>");
<% else %>
$('#comment_reply_<%=@comment.id %>').html("<%= escape_javascript(render :partial => 'users/comment_reply', :locals => {:comment => @comment.parent})%>");
<% end %>

View File

@ -1374,6 +1374,41 @@ function expand_journal_reply(container, btnid, id, type, div_id, allow_delete)
}
}
function expand_message_reply(container, btnid, id, type, div_id, is_course, is_board) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
$.get(
'/users/all_journals',
{
type: type,
id: id,
div_id: div_id,
is_course: is_course,
is_board: is_board
},
function(data) {
}
);
btn.html('收起回复');
//target.show();
} else if(btn.data('init') == '1') {
btn.data('init', 3);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
else {
btn.data('init', 1);
btn.html('收起回复');
target.show();
}
}
function expand_reply_homework(container, btnid, id, type, div_id, is_in_course, course_activity, user_activity_id) {
var target = $(container);
var btn = $(btnid);

View File

@ -190,7 +190,7 @@ a.postOptionLink2:hover {color:#ffffff; background-color:#269ac9;}
.imageFuzzy {filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity:0.5;opacity: 0.5;}
.homepagePostReplyDes {float:left; width:632px; margin-left:15px;}
.homepagePostReplyPublisher {font-size:12px; color:#888888; margin-bottom:5px;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;}
.homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 20px;}
.homepagePostReplyContent ul li{list-style-type: disc;margin-left: 20px;}
.homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;}
@ -1429,4 +1429,4 @@ a.pages-big{ width:50px;}
.W300 {width:300px !important;}
.W600{ width:600px;}
.syllabus_input {width: 290px; border: 1px solid #64bdd9; height: 30px;}
.syllabus_input {width: 290px; border: 1px solid #64bdd9; height: 30px;}

View File

@ -666,7 +666,7 @@ a.postReplyCancel:hover {color:#ffffff;}
.homepagePostReplyPortrait {float:left; width:45px;}
.homepagePostReplyDes {float:left; width:620px; margin-left:15px;}
.homepagePostReplyPublisher {font-size:12px; color:#484848; margin-bottom:5px;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin-bottom:12px;}
.homepagePostReplyContent {font-size:12px; color:#484848; margin:3px 5px 12px 5px;}
.homepagePostReplyContent ol li{list-style-type: decimal;margin-left: 40px;}
.homepagePostReplyContent ul li{list-style-type: disc;margin-left: 40px;}
.homepagePostReplyContent td,.homepagePostReplyContent tr {border: 1px solid; border-color: inherit;}
@ -1184,4 +1184,46 @@ a.shadowbox_news_all{ display:block; width:305px; height:40px; line-height:40px;
.reply_iconup{ position:absolute; top:21px; left:13px; color:#d4d4d4; font-size:16px; background:#f1f1f1; line-height:13px;}
/*20160622代码分析弹窗*/
.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;}
.analysis-option-box {width:100%; border:1px solid #ccc; padding:3px 5px;}
/* 二级回复 */
.clearfix:after { content:"."; display:block; height:0; visibility:hidden; clear:both; }
.clearfix { zoom:1; }
.clearit { clear:both; height:0; font-size:0; overflow:hidden; }
.comment_item{ width:720px; background-color:#f1f1f1; color:#888;}
.comment_top{ height:15px; border: 1px solid #e4e4e4; padding:10px; position:relative;}
.reply_iconup{ position:absolute; top:21px; left:13px; color:#d4d4d4; font-size:16px; background:#f1f1f1; line-height:13px;}
.fl{ float:left;}
.fr{ float:right;}
.comment_item_cont{ padding:15px; border-bottom:1px solid #e3e3e3;}
.J_Comment_Face img{ width:40px; height:40px; }
.t_content{ width:92%; margin-left:15px;}
a.content-username { color:#269ac9; font-size:14px; margin-right:15px;}
a.content-username:hover{ color:#297fb8;}
.orig_user img{width:32px; height:32px;}
.reply-right{ float:right; position:relative;}
.reply_iconup02{ position:absolute; top:16px; left:4px; color:#d4d4d4; font-size:16px; background:#f1f1f1; line-height:13px;}
.comment_orig_content{margin:10px 0; color:#999;}
.comment_orig_content .comment_orig_content{margin-top:0;}
.orig_cont{ border:solid 1px #F3DDB3; background:#FFFEF4; padding:4px;color:#999;margin-top:-1px;}
.orig_cont_sub{ border-top:0}
.orig_index{ float:right; color:#666; font-family:Arial; padding-right:5px;line-height:30px;}
.orig_user{ margin:10px 15px 10px 5px;}
.orig_user span{ color:#999; padding-right:5px;}
.orig_content{padding:5px 0px 5px 0px;line-height:24px; color:#333; }
.orig_right{ width:80%; margin-top:5px;}
a.comment_ding_link{ height:24px;line-height:24px;display:inline-block;padding-left:2px;vertical-align:middle; color:#333; }
a:hover.comment_ding_link{ color:#269ac9;}
.comment_ding_link span{display: inline-block;padding: 0 0px 0 8px;}
.comment_ding_link em{font-style: normal;font-family: arial;}
.comment_reply_link{ display:inline-block; width:50px; height:24px;line-height: 24px; vertical-align:middle;text-align: center;}
.comment_reply_link:link,.comment_reply_link:visited{color:#333;text-decoration: none;}
.comment_content{ color:#333;}
.t_txt{ margin-top:10px;}
.orig_reply_box{border-top:1px solid #e3e3e3; width:95%; padding:15px 0px 15px 25px;}
.orig_reply_box2{border-top:1px solid #e3e3e3; width:95%; padding:10px 25px 10px 0;}
.orig_textarea{width:90%; margin-bottom:10px;}
.orig_sub{ float:right; background-color:#269ac9; color:#fff; height:25px; line-height:25px; text-align:center; width:80px; border:none;}
.orig_sub:hover{ background:#297fb8;}
.orig_cont_hide{ text-align:center; width:624px; display:block; font-size:14px; color:#333; border-bottom:1px solid #F3DDB3; padding:8px 0;}
.orig_icon{ color:#888; margin-right:10px; font-size:14px; font-weight:bold;}