题库的来源排序不可用

题库的分布时间排序
This commit is contained in:
cxt 2016-03-18 16:23:24 +08:00
parent fdcd44e240
commit 74e77bf347
2 changed files with 4 additions and 4 deletions

View File

@ -573,7 +573,7 @@ class UsersController < ApplicationController
@r_sort = @b_sort == "desc" ? "asc" : "desc" @r_sort = @b_sort == "desc" ? "asc" : "desc"
@user = User.current @user = User.current
search = params[:name].to_s.strip.downcase search = params[:name].to_s.strip.downcase
type_ids = params[:property]=="" ? "(1, 2, 3)" : "(" + params[:property] + ")" type_ids = params[:property]=="" || params[:property].nil? ? "(1, 2, 3)" : "(" + params[:property] + ")"
if(params[:type].blank? || params[:type] == "1") #全部 if(params[:type].blank? || params[:type] == "1") #全部
visible_course = Course.where("is_public = 1 && is_delete = 0") visible_course = Course.where("is_public = 1 && is_delete = 0")
visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")" visible_course_ids = visible_course.empty? ? "(-1)" : "(" + visible_course.map{|course| course.id}.join(",") + ")"

View File

@ -25,9 +25,9 @@
<% end%> <% end%>
</li> </li>
<li class="fl subject-list-date"> <li class="fl subject-list-date">
<%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "fl",:remote => true%> <%= link_to "发布时间",user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "fl",:remote => true%>
<% if @order == "created_at"%> <% if @order == "publish_time"%>
<%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "created_at", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%> <%= link_to "", user_search_homeworks_user_path(@user,:name=>search,:type => type,:is_import=>is_import,:property=>property,:order => "publish_time", :sort => @r_sort),:class => "#{@r_sort == 'desc' ? 'st_up' : 'st_down'} mt12 fl" ,:remote => true%>
<% end%> <% end%>
</li> </li>
</ul> </ul>