<div class = "cl"> </div>
<div id="project-boardlist">
  <div class="listbox mt10" >
    <h2 class="list-h2">讨论区列表</h2>
    <div class="category">
      <span class="grayTxt ">排序：</span>
      <%= link_to "时间", {:controller => 'boards', :action => 'index',  :type => @type,  :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
      <% if @type.to_i == 1 %>
          <%= link_to "", {:controller => 'boards', :action => 'index', :type => @type,  :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
      <% end %>
      <%= link_to "人气", {:controller => 'boards', :action => 'index',  :type => @type,  :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
      <% if @type.to_i  == 2 %>
          <%= link_to "", {:controller => 'boards', :action => 'index', :type => @type,  :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
      <% end %>
      <div class="cl"></div>
    </div>
    <div class="bloglistbox">
      <% if topics.any? %>
          <% topics.each do |activity| %>
              <div class="list-file">
                <div><span class="item_list fl"></span>
                  <% if activity.parent_id.nil? %> <!--+"(帖子标题)"-->
                      <%= link_to activity.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title fl" %>
                  <% else %>
                      <%= link_to activity.parent.subject.to_s.html_safe, board_message_path(activity.board_id, activity), :class=> "list-title f1" %>
                  <% end %>
                  <% if activity.sticky == 1 %>
                      <span class="fl ml10 red-cir-btn">顶</span>
                  <% end%>
                  <% if activity.locked %>
                      <span class="fl ml10 green-cir-btn" title="已锁定">锁</span>
                  <% end %>
                  <% u = User.where("id=?",activity.author_id).first%>
                  <div class="cl"></div>
                </div>
                <div class="massages-content ml15">
                  <% if activity.parent_id.nil? %>
                      <% content = activity.content %>
                  <% else %>
                      <% content = activity.parent.content %>
                  <% end %>
                  <p><%=render :partial =>"users/intro_content_ex", :locals=>{:user_activity_id =>activity.id, :content=>content, :maxheight=>54, :maxwordsnum=>75, :maxwidth=>563} %></p>
                </div>
                <div class="ml15 mt10 f12">
                  <span class="grayTxt">
                      发帖人:<%=(u.try(:realname) != " " ? u.lastname + u.firstname : u.try(:login)) %>
                  </span>
                  <span class="grayTxt">更新：<%= format_time(activity.children.any? ? activity.children.last[:created_on] : activity[:created_on] ) %></span>
                  <% count=0 %>
                  <% if activity.parent %>
                      <% count=activity.parent.children.count%>
                  <% else %>
                      <% count=activity.children.count%>
                  <% end %>
                  <p class="list-info fr grayTxt"><span><%= count>0 ? "#{count}" : "0" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "0" %></span><span>赞</span></p>
                </div>
                <div class="cl"></div>
              </div>
          <% end %>
          <div>
            <ul class="wlist" id="pages" >
              <%= pagination_links_full @atta_pages, @atta_count, :per_page_links => false, :remote => @is_remote, :flag => true %>
            </ul>
            <div class="cl"></div>
          </div>
      <% else %>
          <p class="nodata"><%= l(:label_no_data) %></p>
      <% end %>
    </div>
  </div>
</div>
<script type="text/javascript">
    //如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
    $(function() {
        var leftHeight = $("#LSide").height() - $(".fontGrey5").height() - 20;
        var rightHeight = $(".homepageRight").height();
        if (rightHeight < leftHeight) {
            var diffHeight = leftHeight - rightHeight;
            var tmpHeight = $(".listbox").height() + diffHeight;
            $(".listbox").css("height", tmpHeight);
        }
    });
</script>