实训任务项目动态展开更多与收起回复功能

This commit is contained in:
daiao 2017-02-23 17:09:22 +08:00
parent 705f94428e
commit 75f1fc964a
4 changed files with 59 additions and 13 deletions

View File

@ -4353,6 +4353,11 @@ class UsersController < ApplicationController
@journals = @activity.journals.reorder("created_on desc")
@user_activity_id = params[:div_id].to_i if params[:div_id]
@user_activity = ForgeActivity.where(params[:div_id].to_i).first if params[:div_id]
when 'is_project_training_task'
@activity = TrainingTask.where('id = ?', params[:id].to_i).first
@journals = @activity.journals.reorder("created_on desc")
@user_activity_id = params[:div_id].to_i if params[:div_id]
@user_activity = ForgeActivity.where(params[:div_id].to_i).first if params[:div_id]
when 'BlogComment'
obj = BlogComment.where('id = ?', params[:id].to_i).first
@user_activity_id = params[:div_id].to_i if params[:div_id]

View File

@ -83,9 +83,9 @@
<input type="hidden" name="user_activity_id" value="<%= user_activity_id %>">
<div nhname='toolbar_container_<%= user_activity_id %>'></div>
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='new_message_textarea_<%= user_activity_id%>' name="notes"></textarea>
<a id="new_message_submit_btn_<%= user_activity_id %>" href="javascript:void(0)" onclick="this.style.display='none'" class="blue_n_btn fr" style="display:none;margin-top:6px;">发送111</a>
<a id="new_message_submit_btn_<%= user_activity_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_<%= user_activity_id%>'></p>
<p nhname='contentmsg_<%= user_activity_id %>'></p>
<% end%>
</div>
<% else %>

View File

@ -11,15 +11,19 @@
<% if expand_more %>
<div class="homepagePostReplyBannerMore">
<% if activity.class.to_s == 'Issue' %>
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_issue',<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_issue',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
<% elsif activity.class.to_s == 'Message' %>
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_message',<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_message',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
<% elsif activity.class.to_s == 'TrainingTask' %>
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'is_project_training_task',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
<% else %>
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'<%=activity.class %>',<%=user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
<a id="reply_btn_<%= user_activity_id %>" onclick="expand_reply_homework('#reply_div_<%= user_activity_id %> li','#reply_btn_<%=user_activity_id%>',<%= activity.id %>,'<%=activity.class %>',<%= user_activity_id %>)" data-count="<%= count %>" data-init="0" class=" replyGrey" href="javascript:void(0)" value="show_help" >
展开更多
</a>
<% end %>

View File

@ -1,17 +1,54 @@
<% if params[:type] == 'HomeworkCommon' || params[:type] == 'Work' %>
$('#reply_div_<%= @user_activity_id %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :type => @type, :is_teacher => @is_teacher, :user_activity_id => @user_activity_id, :activity_id => params[:id].to_i}) %>');
$('#reply_div_<%= @user_activity_id %>').html('<%= escape_javascript(render :partial => 'users/news_replies',
:locals => {:comments => @journals,
:type => @type,
:is_teacher => @is_teacher,
:user_activity_id => @user_activity_id,
:activity_id => params[:id].to_i}) %>');
<% elsif params[:type] == 'JournalsForMessage' %>
$('#reply_div_<%= @user_activity_id %>').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}) %>');
$('#reply_div_<%= @user_activity_id %>').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}) %>');
<% 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}) %>');
$('#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}) %>');
<% elsif params[:type] == 'BlogComment' %>
$('#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}) %>');
$('#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}) %>');
<% elsif params[:type] == 'OrgDocumentComment' %>
$('#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}) %>');
$('#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}) %>');
<% elsif params[:type] == 'News' || params[:type] == 'Issue' || params[:type] == 'Syllabus' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'users/news_replies', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'users/news_replies',
:locals => {:comments => @journals,
:user_activity_id => @user_activity_id,
:type => @type,
:activity_id => params[:id].to_i}) %>');
<% elsif params[:type] == 'is_project_issue' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'projects/project_issue_expand_show', :locals => {:comments => @journals, :user_activity_id => @user_activity_id, :activity => @activity}) %>');
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'projects/project_issue_expand_show',
:locals => {:comments => @journals,
:user_activity_id => @user_activity_id,
:activity => @activity}) %>');
<% elsif params[:type] == 'is_project_training_task' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'projects/project_issue_expand_show',
:locals => {:comments => @journals,
:user_activity_id => @user_activity_id,
:activity => @activity}) %>');
<% elsif params[:type] == 'is_project_message' %>
$('#reply_div_<%= params[:div_id].to_i %>').html('<%=escape_javascript(render :partial => 'projects/project_message_replies', :locals => {:comments => @journals,:user_activity_id => @user_activity_id, :type => @type, :activity_id => params[:id].to_i}) %>');
$('#reply_div_<%= params[:div_id].to_i %>').html('<%= escape_javascript(render :partial => 'projects/project_message_replies',
:locals => {:comments => @journals,
:user_activity_id => @user_activity_id,
:type => @type,
:activity_id => params[:id].to_i}) %>');
<% end %>