课程问答区 项目讨论区列表

This commit is contained in:
yuanke 2016-04-26 15:10:47 +08:00
parent bb80cad1e3
commit 43c1120b19
13 changed files with 266 additions and 151 deletions

View File

@ -25,6 +25,7 @@ class BlogsController < ApplicationController
if @order.to_i == 2
@type = 2
@b_sort == 1 ? @topics = @topics.sort{|x,y| get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) <=> get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) } : @topics = @topics.sort{|x,y| get_praise_num(y) + (y.parent ? y.parent.children.count : y.children.count) <=> get_praise_num(x) + (x.parent ? x.parent.children.count : x.children.count) }
@topics = @topics.sort{|x,y| y.sticky <=> x.sticky}
else
@type = 1
end

View File

@ -62,13 +62,24 @@ class BoardsController < ApplicationController
else
render_403
end
end
end
def show
# 讨论区消息状态更新(已读和未读)
@order, @b_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type 1升序 2 降序
if @order.to_i == @type.to_i
@b_sort = @b_sort.to_i == 1 ? 2 : 1
else
@b_sort = 2
end
sort_name = "updated_at"
sort_type = @b_sort == 1 ? "asc" : "desc"
if @project
ForgeMessage.where("user_id =? and project_id =? and viewed =?", User.current.id, @project.id, 0).update_all(:viewed => true)
# 更新@消息为已读
@ -82,10 +93,10 @@ class BoardsController < ApplicationController
CourseMessage.where("user_id =? and course_id =? and viewed =?", User.current.id, @course.id, 0).update_all(:viewed => true)
end
sort_init 'updated_on', 'desc'
sort_update 'created_on' => "#{Message.table_name}.created_on",
'replies' => "#{Message.table_name}.replies_count",
'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
# sort_init 'updated_on', 'desc'
# sort_update 'created_on' => "#{Message.table_name}.created_on",
# 'replies' => "#{Message.table_name}.replies_count",
# 'updated_on' => "COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on)"
@is_new = params[:is_new]
@topic_count = @board ? @board.topics.count : 0
@ -93,26 +104,31 @@ class BoardsController < ApplicationController
if @board
limit = 10;
@topic_count = @board.topics.count();
@topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc").
limit(limit).offset(@topic_pages).includes(:last_reply).
@topic_pages = 0#(params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").
offset(@topic_pages).includes(:last_reply).
preload(:author, {:last_reply => :author}).all();
else
@topics = [];
end
elsif @course
if (@board)
limit = 10;
@topic_count = @board.topics.count();
@topic_pages = (params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) desc").
limit(limit).offset(@topic_pages).includes(:last_reply).
preload(:author, {:last_reply => :author}).all();
@topic_pages = 0 #(params[:page] ? params[:page].to_i + 1 : 0) *10
@topics = @board.topics.reorder("#{Message.table_name}.sticky DESC, COALESCE(last_replies_messages.created_on, #{Message.table_name}.created_on) #{sort_type}").offset(@topic_pages).includes(:last_reply).preload(:author, {:last_reply => :author}).all();
else
@topics = [];
end
end
#分页
@limit = 10
@is_remote = true
@atta_count = @topics.count
@atta_pages = Paginator.new @atta_count, @limit, params['page'] || 1
@offset ||= @atta_pages.offset
@topics = paginateHelper @topics,@limit
@page = params[:page] ? params[:page].to_i + 1 : 0
@message = Message.new(:board => @board)
#modify by nwb

View File

@ -2848,7 +2848,6 @@ class UsersController < ApplicationController
def user_courselist
@order, @c_sort,@type = params[:order] || 1, params[:sort] || 1, params[:type] || 1
#确定 sort_type
if @order.to_i == @type.to_i
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
@ -2871,7 +2870,6 @@ class UsersController < ApplicationController
@type = 2
@courses.each do |course|
course[:infocount] = (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) ? (course.homework_commons.count + visable_attachemnts_incourse(course).count) : (course.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(course).count)
puts course[:infocount]
end
@c_sort == 1 ? (@courses = @courses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@courses = @courses.sort{|x,y| y[:infocount] <=> x[:infocount]})
else

View File

@ -4,13 +4,13 @@
<h2 class="list-h2">博客列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'blogs', :action => 'index', :id =>@user.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<%= link_to "时间", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'blogs', :action => 'index', :id =>@user.id, :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<%= link_to "", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 1 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'blogs', :action => 'index', :id =>@user.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<%= link_to "人气", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'blogs', :action => 'index', :id =>@user.id, :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<%= link_to "", {:controller => 'blogs', :action => 'index', :id =>@user, :type => @type, :sort => @b_sort, :order => 2 }, :class => "#{@b_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
@ -27,6 +27,12 @@
<% if activity.blog.homepage_id and activity.id == activity.blog.homepage_id %>
<span class="c_red ml10 fl">[已设为首页]</span>
<% 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 %>
<div class="cl"></div>
</li>
<% count=0 %>

View File

@ -2,41 +2,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= javascript_include_tag "create_kindeditor" %>
<% end %>
<% if topics %>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
sd_create_editor_from_data(<%= topic.id%>, null, "100%", "<%=topic.class.to_s%>");
});
</script>
<% if topic %>
<%= render :partial => 'users/course_message', :locals => {:activity => topic, :user_activity_id => topic.id, :is_course => 1, :is_board=>1} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<%= link_to "点击展开更多",boards_topic_path(@board, :course_id => @board.course.id ,:page => page),:id => "show_more_course_topic",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>
<% end%>
<% if @topics || topics %>
<%= render :partial => 'users/course_boardlist', :locals => {:topics => @topics ? @topics: topics , :is_course => 1, :is_board=>1} %>
<% end %>

View File

@ -2,60 +2,7 @@
<%= import_ke(enable_at: false, prettify: false) %>
<%= javascript_include_tag "create_kindeditor" %>
<% end %>
<style type="text/css">
/*回复框*/
/*.homepagePostReplyInputContainer .ke-toolbar {display: none; width: 400px; border: none; background: none; padding: 0px 0px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon {line-height: 26px; font-size: 14px; padding-left: 26px;}*/
/*.homepagePostReplyInputContainer .ke-toolbar-icon-url {background-image: url(/images/public_icon.png)}*/
/*.homepagePostReplyInputContainer .ke-outline {padding: 0px 0px; line-height: 26px; font-size: 14px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons {background-position: 0px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-icon-emoticons:hover {background-position: -79px -671px; width: 50px; height: 26px;}*/
/*.homepagePostReplyInputContainer .ke-outline {border: none;}*/
/*.homepagePostReplyInputContainer .ke-inline-block {display: none;}*/
/*.homepagePostReplyInputContainer .ke-container {float: left;}*/
</style>
<% if topics%>
<% topics.each do |topic| %>
<script>
function expand_reply(container, btnid) {
var target = $(container);
var btn = $(btnid);
if (btn.data('init') == '0') {
btn.data('init', 1);
btn.html('收起回复');
target.show();
} else {
btn.data('init', 0);
btn.html('展开更多');
target.hide();
target.eq(0).show();
target.eq(1).show();
target.eq(2).show();
}
}
function expand_reply_input(id) {
$(id).toggle();
}
$(function () {
sd_create_editor_from_data(<%= topic.id%>, null, "100%");
});
</script>
<% if topic %>
<%= render :partial => 'users/project_message', :locals => {:activity => topic, :user_activity_id => topic.id,:is_course=>1,:is_board=>1} %>
<% end %>
<% end %>
<% if topics.count == 10 %>
<!--<div id="show_more_course_topic" class="loadMore mt10 f_grey">展开更多<%#= link_to "", boards_topic_path(@board, :course_id => @board.course.id ,:page => page), :id => "more_topic_link", :remote => "true", :class => "none" %></div>-->
<%= link_to "点击展开更多", boards_topic_path(@board, :project_id => @board.project.id ,:page => page), :id => "show_more_project_topic",:remote => "true",:class => "loadMore mt10 f_grey"%>
<% end %>
<% end%>
<!--
<script type="text/javascript">
$("#show_more_course_topic").mouseover(function () {
$("#more_topic_link").click();
});
</script>-->
<%if @topics || topics %>
<%= render :partial => 'users/project_boardlist', :locals => {:topics => @topics ? @topics: topics , :is_course => 1, :is_board=>1} %>
<% end %>

View File

@ -1,5 +1,5 @@
<% if @course %>
$("#show_more_course_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/course_show_detail',:locals => {:topics => @topics, :page => @page} )%>");
<%= render :partial => 'users/course_boardlist', :locals => {:topics => @topics, :is_course => 1, :is_board=>1} %>
<% else %>
$("#show_more_project_topic").replaceWith("<%= escape_javascript( render :partial => 'boards/project_show_detail',:locals => {:topics => @topics, :page => @page} )%>");
<% end %>

View File

@ -105,13 +105,13 @@
<div class="homepagePortraitImage fl" id="homepage_portrait_image">
<%= image_tag(url_to_avatar(@user),width:"78", height: "78", :id=>'nh_user_tx') %>
<% if User.current.logged?%>
<% if is_current_user%>
<div id="edit_user_file_btn" class="none">
<div class="homepageEditProfile">
<a href="<%= url_for(:controller => 'my', :action => 'clear_user_avatar_temp') %>" data-remote="true" class="homepageEditProfileIcon"></a>
</div>
</div>
<% end %>
<% if is_current_user%>
<div id="edit_user_file_btn" class="none">
<div class="homepageEditProfile">
<a href="<%= url_for(:controller => 'my', :action => 'clear_user_avatar_temp') %>" data-remote="true" class="homepageEditProfileIcon"></a>
</div>
</div>
<% end %>
<% end%>
</div>
<div class="fl ml10">
@ -189,7 +189,8 @@
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuCourses').slideToggle();">课程</a>
<%= link_to '课程',{:controller => "users", :action => "user_courselist", :id => @user.id}, :class => "homepageMenuText" %>
<% if is_current_user%>
<% if User.current.user_extensions && User.current.user_extensions.identity == 0 && User.current.allowed_to?(:add_course, nil, :global => true)%>
<div class="courseMenu" id="courseMenu">
@ -212,26 +213,25 @@
<% end%>
<% end%>
</div>
<% if @user.courses.visible.count > 0
course_order_ids = "(" +
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
GROUP BY ca.course_id) AS c
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"
courses = Course.where("id in #{course_order_ids}")
else
courses = []
end
%>
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
</ul>
</div>
<% end %>
<% if @user.courses.visible.count > 0
course_order_ids = "(" +
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
GROUP BY ca.course_id) AS c
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"
courses = Course.where("id in #{course_order_ids}")
else
courses = []
end
%>
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
<ul>
<%= render :partial => 'layouts/user_courses', :locals => {:courses => courses,:user => @user, :page => 0} %>
</ul>
</div>
<div class="homepageLeftMenuBlock">
<a href="javascript:void(0);" class="homepageMenuText" onclick="$('#homepageLeftMenuForge').slideToggle();">项目</a>
@ -240,13 +240,13 @@
<% end%>
</div>
<% if @user.projects.visible.count > 0
project_order_ids = "(" +
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
project_order_ids = "(" +
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
(SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
GROUP BY fa.project_id) AS p
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"
projects = Project.where("projects.id in #{project_order_ids}")
else
projects = Project.where("projects.id in #{project_order_ids}")
else
projects = []
end
%>

View File

@ -0,0 +1,77 @@
<div class = "cl"> </div>
<div id="blog-list">
<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">
<% 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 %>
<span class="fr grayTxt">
<%= activity.course.name.to_s %>
</span>
<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", :locals=>{:user_activity_id =>activity.id, :content=>content} %></p>
</div>
<div class="ml15">
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %></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}" : "" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></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>
</div>
</div>
</div>
<script type="text/javascript">
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-10;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight){
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height()+diffHeight;
$(".listbox").css("height",tmpHeight);
}
</script>

View File

@ -89,7 +89,7 @@
<div class="homepagePostReply">
<div class="homepagePostReplyBanner">
<div class="homepagePostReplyBannerCount">回复
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;"></span>
<sapn class="mr15"><%= count>0 ? "#{count}" : "" %></sapn><span style="color: #cecece;">?</span>
<span id="praise_count_<%=user_activity_id %>">
<% if activity.author == User.current %>
<span class="ml15 likeButton" title="不能自己赞自己哦!"> <span class="likeText">赞</span><span class="likeNum"><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></span></span>
@ -174,5 +174,4 @@
</div>
<% end %>
</div>
</div>
</div>

View File

@ -0,0 +1,77 @@
<div class = "cl"> </div>
<div id="blog-list">
<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">
<% 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 %>
<span class="fr grayTxt">
<%= activity.project.name.to_s %>
</span>
<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", :locals=>{:user_activity_id =>activity.id, :content=>content} %></p>
</div>
<div class="ml15">
<span class="grayTxt">发帖时间:<%= format_time(activity.created_on) %></span>
<span class="grayTxt">更新时间:<%= format_time(CourseActivity.where("course_act_type='#{activity.class}' and course_act_id =#{activity.id}").first.updated_at) %></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}" : "" %></span><span>回复</span><span>|</span><span><%= get_praise_num(activity) > 0 ? "#{get_praise_num(activity)}" : "" %></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>
</div>
</div>
</div>
<script type="text/javascript">
//如果右边的博客列表比左边的高度低则将右边的高度设为与左边对齐
var leftHeight = $("#LSide").height()-$(".fontGrey5").height()-10;
var rightHeight = $(".homepageRight").height();
if (rightHeight < leftHeight){
var diffHeight = leftHeight - rightHeight;
var tmpHeight = $(".listbox").height()+diffHeight;
$(".listbox").css("height",tmpHeight);
}
</script>

View File

@ -2,13 +2,13 @@
<h2 class="list-h2">课程列表</h2>
<div class="category">
<span class="grayTxt ">排序:</span>
<%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user.id, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<%= link_to "时间", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 1 %>
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user.id, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user.id, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<%= link_to "人气", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt", :remote => true %>
<% if @type.to_i == 2 %>
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user.id, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<%= link_to "", {:controller => 'users', :action => 'user_courselist', :id =>@user, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} ", :remote => true %>
<% end %>
<div class="cl"></div>
</div>

View File

@ -1306,3 +1306,31 @@ a:hover.Blue-btn{ background:#3598db; color:#fff;}
.box-con{ width:450px; margin:0 auto; text-align:center;}
.box-con-a{ width:170px; margin:0 auto; margin-top:10px;}
/*--------------------------------------*/
/*博客列表界面样式*/
a{text-decoration:none}
.listbox{ width:730px; background-color:#fff; border:1px solid #ddd; padding:10px; }
/*.bloglistbox{ min-height:690px;}*/
.list-h2{ font-size:16px; font-weight:bold; color:#000; border-bottom:2px solid #269ac9; padding-bottom:5px;}
.category{ padding:10px 0; border-bottom:1px solid #ddd;}
.category a,.category span{ float:left; margin-right:5px;}
.grayTxt{ color:#9093a6;}
.category a.sortTxt{ color:#9093a6;}
.category .sortTxt:hover{ color:#28be6c;}
a.sortupbtn{ background: url(../images/liststyle.png) 0 3px no-repeat; width:12px; height:17px; display:block; margin-right:10px; cursor:pointer;}
a.sortdownbtn{ background: url(../images/liststyle.png) 0 -12px no-repeat; width:12px; height:17px; display:block;margin-right:10px;cursor:pointer; }
.item_list{ display:block; width:5px; height:5px;-webkit-border-radius: 25px;border-radius:25px; background-color:#adadad; margin:10px 10px 0 0;}
.list-file a.list-title{ font-size:14px; font-weight: bold; color:#000;white-space:nowrap; overflow:hidden; text-overflow:ellipsis; display:block; max-width:635px;}
a:hover.list-title{ color:#269ac9;}
.c_red{ font-weight:normal; font-size:12px;}
.list-file{ padding:10px 0; border-bottom:1px dashed #ddd;}
.list-file li{ line-height:1.9;}
.list-info span{ margin-left:5px;}
.pages a{ display:block; border:1px solid #d1d1d1; color:#000; float:left; width:30px; text-align:center; padding:3px 0; line-height:1.9; margin-right:5px; }
.pages a:hover{ background-color:#269ac9; color:#fff;}
a.pages-big{ width:50px;}
.pages .active{ background-color:#269ac9; color:#fff;}
.pages{width:330px; margin:20px auto 10px;}
.red-cir-btn{ background:#e74c3c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}
.green-cir-btn{ background:#28be6c; padding:1px 5px; -moz-border-radius:2px; -webkit-border-radius:2px; border-radius:2px; color:#fff; font-weight:normal;font-size:12px;}