动态代码的优化

This commit is contained in:
cxt 2016-09-30 14:48:42 +08:00
parent 5d0e3889df
commit a63f58de5b
10 changed files with 30 additions and 30 deletions

View File

@ -106,7 +106,8 @@
</div>
<div class="cl"></div>
<% all_comments = []%>
<% count=get_all_children(all_comments, @article).count %>
<% all_replies = get_all_children(all_comments, @article) %>
<% count= all_replies.count %>
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
@ -119,8 +120,7 @@
<div class="homepagePostReplyBannerTime"></div>
</div>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @article) %>
<% comments = all_replies %>
<% if count > 0 %>
<div class="" id="reply_div_<%= @article.id %>">
<% comments.each do |comment| %>

View File

@ -46,12 +46,12 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% all_repies = get_all_children(all_comments, activity) %>
<% count = all_repies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 1} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% comments = all_repies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 1, :user_id => activity.author_id}%>

View File

@ -75,7 +75,8 @@
</div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, @document).count %>
<% all_replies = get_all_children(all_comments, @document) %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= @document.id %>">
<%# if count > 0 %>
@ -88,8 +89,7 @@
</div>
</div>
<% all_comments = []%>
<% comments = get_all_children(all_comments, @document) %>
<% comments = all_replies %>
<div class="" id="reply_div_<%= @document.id %>">
<% comments.each do |comment| %>
<script type="text/javascript">

View File

@ -70,12 +70,12 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% all_replies = get_all_children(all_comments, activity) %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => 0,:is_board =>0} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'Message', :activity_id =>activity.id, :is_course => 0, :is_board =>0}%>

View File

@ -68,13 +68,13 @@
</div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, document).count %>
<% all_replies = get_all_children(all_comments, document) %>
<% count = all_replies.count %>
<div class="homepagePostReply fl" style="background-color: #f1f1f1;" id="<%= document.id %>">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => document, :user_activity_id => act.id} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, document)[0..2] %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= act.id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => act.id, :type => 'OrgDocumentComment', :activity_id =>document.id}%>

View File

@ -41,12 +41,12 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% all_replies = get_all_children(all_comments, activity) %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>

View File

@ -81,12 +81,12 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% all_replies = get_all_children(all_comments, activity) %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id,:is_course => is_course,:is_board =>is_board} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= 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}%>

View File

@ -82,14 +82,14 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% all_replies = get_all_children(all_comments, activity) %>
<% count = all_replies.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,:is_course => is_course,:is_board =>is_board} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= 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}%>

View File

@ -42,12 +42,12 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% all_replies = get_all_children(all_comments, activity) %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id, :homepage => 0} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'BlogComment', :activity_id =>activity.id, :homepage => 0, :user_id => activity.author_id}%>

View File

@ -63,12 +63,12 @@
<div class="cl"></div>
</div>
<% all_comments = []%>
<% count=get_all_children(all_comments, activity).count %>
<% all_replies = get_all_children(all_comments, activity) %>
<% count = all_replies.count %>
<div class="homepagePostReply">
<%= render :partial => 'users/reply_banner', :locals => {:count => count, :activity => activity, :user_activity_id => user_activity_id} %>
<% all_comments = []%>
<% comments = get_all_children(all_comments, activity)[0..2] %>
<% comments = all_replies[0..2] %>
<% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>">
<%= render :partial => 'users/message_replies', :locals => {:comments => comments, :user_activity_id => user_activity_id, :type => 'JournalsForMessage', :activity_id =>activity.id}%>