From 31e338f1e51e0ad49ce5de17a5c1603253ed4e7c Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 3 Jul 2014 10:12:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3http://127.0.0.1:3000/=3Fcour?= =?UTF-8?q?se.trustie.net=E9=93=BE=E6=8E=A5=E8=B7=B3=E8=BD=AC=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 6 +++++- app/helpers/welcome_helper.rb | 5 +++-- app/models/course.rb | 1 + app/views/welcome/course.html.erb | 2 +- config/routes.rb | 1 + 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7660c0509..c9dc4fa26 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -473,7 +473,11 @@ module ApplicationHelper def principals_check_box_tags_ex(name, principals) s = '' principals.each do |principal| - s << "\n" + if principal.has_attribute?(:userInfo) + s << "\n" + else + s << "\n" + end end s.html_safe end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 048933e40..d41e6bd95 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -182,11 +182,12 @@ module WelcomeHelper sort_course_by_hot limit end + # modif by nwb def find_all_new_hot_course limit = 9 ,school_id = 0 #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}%' and #{Project.table_name}.identifier not in - (select extra from courses where school_id = ?)", 1,school_id).order("course_ac_para DESC").limit(limit).all + Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <> + ?", school_id).order("course_ac_para DESC").limit(limit).all end def find_all_hot_bid diff --git a/app/models/course.rb b/app/models/course.rb index 51b118679..ff5e4fbd8 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -27,6 +27,7 @@ class Course < ActiveRecord::Base has_many :boards, :dependent => :destroy, :order => "position ASC" #has_many :course_journals_for_messages, :class_name => 'CourseJournalsForMessage', :as => :jour, :dependent => :destroy has_many :news, :dependent => :destroy, :include => :author + has_one :course_status, :class_name => "CourseStatus", :dependent => :destroy acts_as_taggable acts_as_nested_set :order => 'name', :dependent => :destroy diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb index ce53924ed..5ec76e4cc 100644 --- a/app/views/welcome/course.html.erb +++ b/app/views/welcome/course.html.erb @@ -75,7 +75,7 @@

新开课程

<% school_course = find_miracle_course(10, 7,params[:school_id]) %> <% if(school_course.count == 0) %> - <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %> + <%= link_to "更多>>", {:controller => 'courses', :action => 'course', :project_type => 1, :school_id => nil} %>