修改统计数字

This commit is contained in:
huang 2016-12-30 20:31:19 +08:00
parent 82a3ff01ef
commit 6fcf80cd3c
2 changed files with 8 additions and 15 deletions

View File

@ -132,8 +132,8 @@ class MemosController < ApplicationController
@memo_new = Memo.new
@my_topic_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is null").count
@my_replies_count = Memo.where("forum_id = #{@memo.forum_id} and author_id = #{User.current.id} and parent_id is not null").count
@my_topic_count = 0
@my_replies_count = Memo.where(:parent_id => @memo.id).count
respond_to do |format|
format.js

View File

@ -7,7 +7,11 @@
<% user_name = @forum.creator.show_name.empty? ? @forum.creator.name : @forum.creator.show_name %>
<div class="fl mb8 mt10">吧主:</div>
<a href="<%= user_path(@forum.creator)%>" target="_blank" class="linkBlue w80 fl mb8 mt10" style="overflow: hidden;white-space: nowrap;text-overflow:ellipsis; "><%= user_name %></a>
<div class="fontGrey3 fl">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @my_replies_count %></a> 帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%= @my_topic_count %></a></div>
<div class="fontGrey3 fl">回答:<a href="javascript:void(0);" class="linkOrange mr5" style="cursor: default"><%= @my_replies_count %></a>
<% unless @my_topic_count == 0 %>
帖子:<a href="javascript:void(0);" class="linkOrange" style="cursor: default"><%= @my_topic_count %></a>
<% end %>
</div>
</div>
<div class="cl"></div>
<div class="fl">
@ -22,18 +26,7 @@
</a>
<% end %>
</div>
<!--<div class="mt15">-->
<!--<div id="forum_tag_list">-->
<!--<%#= render :partial => 'forums/forum_tag_list', :locals => {:forum => @forum} %>-->
<!--</div>-->
<!--<%# if(@forum.creator.id == User.current.id) %>-->
<!--<a href="javascript:void(0)" class="yellowBtn f_l" onclick="$('#add_tag01').slideToggle();">+ 添加标签</a>-->
<!--<%# end %>-->
<!--<span id="add_tag01" style="display:none; vertical-align: middle;" class="ml10 f_l">-->
<!--<input type="text" name="addTag" size="20" class="isTxt w90 f_l" maxlength="<%#= Setting.tags_max_length %>" minlength="<%#= Setting.tags_min_length%>" />-->
<!--<input type="button" class="submit f_l" onclick="addTag();" />-->
<!--</span></div>-->
<!--<div class="cl"></div>-->
<% if @forum.creator.id == User.current.id %>
<span class="postEdit"></span>
<%= link_to "编辑贴吧", edit_forum_path(@forum), :class => "linkGrey3", :remote => true %>