课程默认活跃度排序

This commit is contained in:
wanglinchun 2014-01-24 14:29:24 +08:00
parent 7e20f9015e
commit b45332bab0
2 changed files with 7 additions and 5 deletions

View File

@ -182,8 +182,10 @@ class ProjectsController < ApplicationController
@s_type = 2
end
else
@projects = Project.visible.where("project_type = ?", 1).order("created_on desc").offset(@project_pages.offset).limit(@limit).all
@s_type = 0
@projects = sort_project_demo 1, "course_ac_para desc", @project_pages.offset, @limit
@s_type = 1
# @projects = Project.visible.where("project_type = ?", 1).order("created_on desc").offset(@project_pages.offset).limit(@limit).all
# @s_type = 0
end
respond_to do |format|
format.html {

View File

@ -66,18 +66,18 @@ module ProjectsHelper
content = ''.html_safe
case state
when 0
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type), :class=>"selected"), :class=>"selected")
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
when 1
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type), :class=>"selected"), :class=>"selected")
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type)))
when 2
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type)))
content << content_tag('li', link_to(l(:label_sort_by_time), course_path(:project_sort_type => '0', :project_type => project_type)))
# content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type), :class=>"selected"), :class=>"selected")
end