From 5d2bb4ccbdafedbab3ac6d206c375284bfe5a39e Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Tue, 13 May 2014 10:30:15 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=80=89=E6=8B=A9=E5=AD=A6=E6=A0=A1=E8=BF=9B?= =?UTF-8?q?=E5=85=A5=E5=AD=A6=E6=A0=A1=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8?= =?UTF-8?q?=EF=BC=8C=E7=82=B9=E5=87=BB=E6=9B=B4=E5=A4=9A=E7=94=B1=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=89=80=E6=9C=89=E8=AF=BE=E7=A8=8B=E5=8F=AF=E8=83=BD?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E5=AD=A6?= =?UTF-8?q?=E6=A0=A1=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=EF=BC=8C=E4=B9=8B?= =?UTF-8?q?=E5=90=8E=E6=8E=92=E5=BA=8F=E4=B9=9F=E4=B8=80=E6=A0=B7=202.?= =?UTF-8?q?=E5=BD=93=E6=9F=A5=E8=AF=A2=E5=AD=A6=E6=A0=A1=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E6=8E=A8?= =?UTF-8?q?=E8=8D=90=E6=94=B9=E4=B8=BA=E6=9C=AC=E7=B3=BB=E7=BB=9F=E4=B8=AD?= =?UTF-8?q?=E6=9C=AC=E5=B9=B4=E5=BA=A6=E5=BC=80=E8=AE=BE=E7=9A=84=E6=9C=80?= =?UTF-8?q?=E5=A5=BD=E7=9A=84=E8=AF=BE=E7=A8=8B=EF=BC=8C=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E7=A8=8B=E6=94=B9=E4=B8=BA=E5=85=B3?= =?UTF-8?q?=E6=B3=A8=E8=AF=BE=E7=A8=8B=E3=80=82=E6=AD=A4=E6=97=B6=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=9B=B4=E5=A4=9A=E6=9F=A5=E7=9C=8B=E7=9A=84=E4=B8=BA?= =?UTF-8?q?=E6=89=80=E6=9C=89=E8=AF=BE=E7=A8=8B=203.=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=87=BA=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E5=B0=86=E5=AD=A6?= =?UTF-8?q?=E6=A0=A1=E5=92=8C=E6=95=99=E5=B8=88=E6=94=BE=E5=9C=A8=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=B8=8A=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/projects_controller.rb | 2 +- app/helpers/projects_helper.rb | 26 +- app/helpers/welcome_helper.rb | 6 + app/views/projects/course.html.erb | 2 +- app/views/welcome/course.html.erb | 321 +++++++++++++------------ 5 files changed, 185 insertions(+), 172 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index d26cf698..a120394e 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -198,7 +198,7 @@ class ProjectsController < ApplicationController @project_type = params[:project_type] @school_id = params[:school_id] per_page_option = 10 - if @school_id == "0" or @school.nil? + if @school_id == "0" or @school_id.nil? @projects_all = Project.active.visible. joins("LEFT JOIN #{ProjectStatus.table_name} ON #{Project.table_name}.id = #{ProjectStatus.table_name}.project_id"). where("#{Project.table_name}.project_type = ? ", Project::ProjectType_course) diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb index 5bd677bd..bddf9d0d 100644 --- a/app/helpers/projects_helper.rb +++ b/app/helpers/projects_helper.rb @@ -62,33 +62,33 @@ module ProjectsHelper content_tag('div', content, :class => "tabs_enterprise") end - def sort_course(state, project_type) + def sort_course(state, project_type, school_id) 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), :school_id => school_id, :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, :school_id => school_id))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) 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, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id), :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))) - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) 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, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # 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") - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type))) + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id))) #gcm when 3 - 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, :school_id => school_id))) + content << content_tag('li', link_to(l(:label_sort_by_active), course_path(:project_sort_type => '1', :project_type => project_type, :school_id => school_id))) # content << content_tag('li', link_to(l(:label_sort_by_influence), course_path(:project_sort_type => '2', :project_type => project_type))) - content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type), :class=>"selected"), :class=>"selected") + content << content_tag('li', link_to(l(:label_sort_by_activity), course_path(:project_sort_type => '3', :project_type => project_type, :school_id => school_id), :class=>"selected"), :class=>"selected") end #gcmend diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index ed435fe6..e05f789a 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -154,6 +154,12 @@ module WelcomeHelper sort_course_by_hot limit end + def find_all_new_hot_course limit = 9 + #sort_project_by_hot_rails 1, 'course_ac_para DESC', limit + time_now = Time.new.strftime("%Y"); + Project.visible.joins(:project_status).where("#{Project.table_name}.project_type = ? and #{Project.table_name}.created_on like '%#{time_now}%'", 1).order("course_ac_para DESC").limit(limit).all + end + def find_all_hot_bid sort_bid_by_hot end diff --git a/app/views/projects/course.html.erb b/app/views/projects/course.html.erb index 1359b8be..98228c16 100644 --- a/app/views/projects/course.html.erb +++ b/app/views/projects/course.html.erb @@ -30,7 +30,7 @@ <% end %> -<%= sort_course(@s_type, @project_type)%> +<%= sort_course(@s_type, @project_type, @school_id)%>
- 该学校未开设任何课程,您可以查看其他学校课程 -
- - <% find_all_hot_course(9).map do |project| %> -+ 该学校未开设任何课程,您可以查看其他学校课程 +
+ + <% find_all_new_hot_course(9).map do |project| %> +当前网站状态 | -活跃课程: <%=@courseCount%> | -高校: 2个 | -教师: <%=@teacherCount%> 名 | -学生: <%=@studentCount%> 名 | - |
当前网站状态 | +活跃课程: <%=@courseCount%> | +高校: 2个 | +教师: <%=@teacherCount%> 名 | +学生: <%=@studentCount%> 名 | + |