实训项目叠层回复功能

This commit is contained in:
daiao 2017-02-22 10:08:05 +08:00
parent 4a925201eb
commit 06306e0214
10 changed files with 41 additions and 26 deletions

View File

@ -457,7 +457,7 @@ class TrainingTasksController < ApplicationController
# 非动态页面直接刷新,动态页面手动刷新
def delete_journal
@is_project = params[:is_project]
@issue = Issue.find(params[:id])
@training_task = TrainingTask.find(params[:id])
begin
forge_acts = ForgeMessage.where(:forge_message_type => "Journal", :forge_message_id => params[:journal_id])
forge_acts.destroy_all unless forge_acts.empty?
@ -472,7 +472,7 @@ class TrainingTasksController < ApplicationController
if @user_activity_id
format.js
else
format.js{ redirect_to issue_url(@issue)}
format.js{ redirect_to training_task_path(@training_task)}
end
end
end

View File

@ -417,6 +417,11 @@ class UsersController < ApplicationController
comment = @root.journals.build(:user_id => User.current.id, :reply_id => params[:reply_id], :notes => params[:reply_message], :parent_id => reply.id)
comment.save
@is_project = params[:is_project] if params[:is_project]
when 'TrainingTask'
@root = reply.training_task
comment = @root.journals.build(:user_id => User.current.id, :reply_id => params[:reply_id], :notes => params[:reply_message], :parent_id => reply.id)
comment.save
@is_project = params[:is_project] if params[:is_project]
when 'Syllabus'
@root = Syllabus.find reply.jour_id
options = {:notes => params[:reply_message], :reply_id => reply.user_id,:user_id => User.current.id,:m_parent_id => params[:reply_id].to_i,:m_reply_id => params[:reply_id].to_i, :root_id => reply.root_id}

View File

@ -3697,7 +3697,7 @@ def get_reply_by_type type, reply_id
reply = OrgDocumentComment.find reply_id
when 'News','Comment'
reply = Comment.find reply_id
when 'Issue'
when 'Issue', 'TrainingTask'
reply = Journal.find reply_id
when 'Journal'
reply = Journal.find reply_id

View File

@ -43,7 +43,7 @@
{:controller => 'training_tasks',
:action => 'delete_journal',
:id => @training_task.id,
:journal_id=>comment.id},
:journal_id => comment.id},
:method => :get,
:remote => true,
:id => "delete_reply_#{comment.id}",

View File

@ -1,8 +1,8 @@
<div class="orig_cont clearfix">
<% unless comment.parent.nil? %>
<div>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
<%= render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>
<% end %>
<%=render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
<%= render :partial => 'users/comment_reply_detail', :locals => {:comment => comment, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id} %>
</div>

View File

@ -26,9 +26,13 @@
<% topic = comment.root %>
<% if !topic.locked? && authorize_for('messages', 'reply') %>
<span class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id},
<%= link_to(l(:button_reply),
{:controller => 'users' ,
:action => 'reply_to_comment',
:reply_id => comment.id,
:type => type,
:user_activity_id => user_activity_id,
:parent_id => parent_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>
@ -37,9 +41,13 @@
<% end %>
<% else %>
<span class="fr mr20">
<%= link_to(
l(:button_reply),
{:controller => 'users' ,:action => 'reply_to_comment', :reply_id => comment.id, :type => type, :user_activity_id => user_activity_id, :parent_id => parent_id},
<%= link_to(l(:button_reply),
{:controller => 'users',
:action => 'reply_to_comment',
:reply_id => comment.id,
:type => type,
:user_activity_id => user_activity_id,
:parent_id => parent_id},
:remote => true,
:method => 'get',
:title => l(:button_reply)) %>

View File

@ -6,7 +6,7 @@
<% parents_rely = [] %>
<% parents_rely = get_reply_parents parents_rely, comment %>
<% length = parents_rely.length %>
<div id="comment_reply_<%=comment.id %>">
<div id="comment_reply_<%= comment.id %>">
<% if length <= 5 %>
<%=render :partial => 'users/comment_reply', :locals => {:comment => comment.parent, :type => type, :user_activity_id => user_activity_id, :parent_id => comment.id} %>
<% else %>

View File

@ -6,7 +6,7 @@
<%= form_for('new_form',:url => {:controller => 'users', :action => 'reply_detail', :reply_id => reply.id, :type => @type, :is_project => @is_project, :user_activity_id => @user_activity_id},:method => "post", :remote => true) do |f| %>
<div nhname='toolbar_container_<%= reply.id%>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= reply.id%>' name="reply_message"></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>
<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;">发送11</a>
<div class="cl"></div>
<p nhname='contentmsg_<%= reply.id%>'></p>
<% end%>

View File

@ -38,6 +38,8 @@ $("#activity_post_reply_<%= @user_activity_id%>").html("<%= escape_javascript(re
<% else %>
window.location.href = "<%=issue_path(@root) %>";
<% end %>
<% elsif @type == 'TrainingTask' %>
window.location.href = "<%= training_task_path(@root) %>";
<% elsif @type == 'OrgDocumentComment' %>
<% if @user_activity_id.to_i != @root.id %>
$("#activity_post_reply_<%= @user_activity_id %>").html("<%= escape_javascript(render :partial => 'organizations/org_document_post_reply', :locals => {:activity => @root, :user_activity_id => @user_activity_id}) %>");

View File

@ -1,10 +1,10 @@
if($("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id%>").length > 0) {
$("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id%>").replaceWith("<%= escape_javascript(render :partial => 'users/reply_to_comment', :locals => {:reply => @reply}) %>");
if($("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id %>").length > 0) {
$("#comment_reply_<%=@parent_id %> #reply_message_<%= @reply.id %>").replaceWith("<%= escape_javascript(render :partial => 'users/reply_to_comment', :locals => {:reply => @reply}) %>");
$("#comment_reply_<%=@parent_id %> #reply_iconup_<%=@reply.id %>").show();
$(function(){
sd_create_editor_from_data(<%= @reply.id%>,null,"100%", "<%= @reply.class.to_s %>");
sd_create_editor_from_data(<%= @reply.id %>,null,"100%", "<%= @reply.class.to_s %>");
});
}else if($("#comment_reply_<%=@parent_id %> #reply_to_message_<%= @reply.id%>").length >0) {
$("#comment_reply_<%=@parent_id %> #reply_to_message_<%= @reply.id%>").replaceWith("<p id='reply_message_<%= @reply.id%>'></p>");
$("#comment_reply_<%=@parent_id %> #reply_iconup_<%=@reply.id %>").hide();
}else if($("#comment_reply_<%= @parent_id %> #reply_to_message_<%= @reply.id %>").length >0) {
$("#comment_reply_<%= @parent_id %> #reply_to_message_<%= @reply.id %>").replaceWith("<p id='reply_message_<%= @reply.id %>'></p>");
$("#comment_reply_<%= @parent_id %> #reply_iconup_<%= @reply.id %>").hide();
}