项目动态关联优化(主要优化查询次数)

hjq_new_course
huang 10 years ago
parent 9ce39d2f4a
commit e02ad85bbb

@ -48,7 +48,7 @@
</script> </script>
<% unless forge_acts.empty? %> <% unless forge_acts.empty? %>
<% forge_acts.each do |activity| -%> <% forge_acts.includes(:forge_act).each do |activity| -%>
<script> <script>
function expand_reply(container, btnid) { function expand_reply(container, btnid) {
var target = $(container); var target = $(container);
@ -80,7 +80,7 @@
<%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %> <%= render :partial => 'users/project_issue', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :project_id => activity.project_id} %>
<!--message --> <!--message -->
<% when "Message" %> <% when "Message" %>
<%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act,:user_activity_id =>activity.id,:is_course=>1,:is_board=>0} %> <%= render :partial => 'users/project_message', :locals => {:activity => activity.forge_act, :user_activity_id => activity.id, :is_course => 1, :is_board => 0} %>
<!--new 新闻--> <!--new 新闻-->
<% when "News" %> <% when "News" %>
<% if !activity.forge_act.nil? and activity.forge_act.project %> <% if !activity.forge_act.nil? and activity.forge_act.project %>

@ -108,7 +108,7 @@
<% if count > 0 %> <% if count > 0 %>
<div class="" id="reply_div_<%= user_activity_id %>"> <div class="" id="reply_div_<%= user_activity_id %>">
<ul> <ul>
<% activity.children.reorder("created_on desc").each do |reply| %> <% activity.children.includes(:author).reorder("created_on desc").each do |reply| %>
<script type="text/javascript"> <script type="text/javascript">
$(function(){ $(function(){
showNormalImage('reply_content_<%= reply.id %>'); showNormalImage('reply_content_<%= reply.id %>');

Loading…
Cancel
Save