1.修改贴吧分页显示问题2列表优化

This commit is contained in:
yuanke 2016-05-04 11:03:08 +08:00
parent afd176b805
commit 411ae6f89e
6 changed files with 16 additions and 12 deletions

View File

@ -103,7 +103,8 @@ class NewsController < ApplicationController
end
scope_order.each do |topic|
topic[:updated_at] = CourseActivity.where("course_act_type='#{topic.class}' and course_act_id =#{topic.id}").first.updated_at
topic[:updated_at] = topic.course_acts.first.updated_at
#topic[:updated_at] = CourseActivity.where("course_act_type='#{topic.class}' and course_act_id =#{topic.id}").first.updated_at
end
#根据 赞+回复数排序

View File

@ -2858,7 +2858,9 @@ class UsersController < ApplicationController
sort_name = "updated_at"
sort_type = @c_sort == 1 ? "asc" : "desc"
@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 #{sort_type}")
@courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*").order("#{sort_name} #{sort_type}")
# @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 #{sort_type}")
#根据 作业+资源数排序
if @order.to_i == 2
@ -2902,7 +2904,8 @@ class UsersController < ApplicationController
sort_name = "updated_on"
sort_type = @c_sort == 1 ? "asc" : "desc"
@projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}")
@projects = @user.projects.visible.select("projects.*").order("#{sort_name} #{sort_type}")
# @projects = @user.projects.visible.select("projects.*,(SELECT MAX(updated_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a #{sort_type}")
#根据 问题+资源数排序 @project.project_score.issue_num @project.project_score.attach_num
if @order.to_i == 2

View File

@ -29,7 +29,9 @@
<div class="cl"></div>
</div>
<% end %>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
</ul>
<% else %>
<p class="nodata"><%= l(:label_no_data) %></p>
<% end %>

View File

@ -41,9 +41,6 @@
<div id="topics_list">
<%= render :partial => 'show_topics',:locals => {:memos=>@memos}%>
</div>
<ul class="wlist" id="pages" style="float: right;margin-top: 10px;">
<%= pagination_links_full @topic_pages, @topic_count ,:per_page_links => true, :remote => true, :flag => true %>
</ul>
<!--<div class="pageRoll">-->
<!--<div class="pageCell"><a href="javascript:void(0);" class="linkBlue">上一页</a></div>-->

View File

@ -1,2 +1 @@
$("#topics_list").html("<%= escape_javascript(render :partial => 'show_topics',:locals => {:memos=>@memos})%>")
$("#pages").html('<%= pagination_links_full @topic_pages, @topic_count,:per_page_links => false,:remote =>true%>');

View File

@ -346,28 +346,30 @@
</div><!--floatbox end-->
</div>
<script type="text/javascript">
$(function(){
$('#user_hide_course').hide();
$('#user_hide_project').hide();
});
$("#courseMenu").mouseenter(function(){
$("#topnav_course_menu").show();
});
$("#courseMenu").mouseleave(function(){
$("#topnav_course_menu").hide();
});
$('#user_hide_course').hide();
function leftCourseslistChange(){
$('#homepageLeftMenuCourses').slideToggle();
$('#hide_show_courseicon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_courseicon').toggleClass("homepageLeftMenuMoreIcon");
}
$('#user_hide_project').hide();
function leftProjectslistChange(){
$('#homepageLeftMenuForge').slideToggle();
$('#hide_show_projecticon').toggleClass("homepageLeftMenuHideIcon");
$('#hide_show_projecticon').toggleClass("homepageLeftMenuMoreIcon");
}
</script>
</body>
</html>