From 70dc5e2b49ad81d47ab586c3e9409d26d4ed9479 Mon Sep 17 00:00:00 2001 From: nwb Date: Wed, 2 Jul 2014 15:10:33 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E4=B8=BB=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=BA=93=E6=A0=87=E8=AF=86=E5=85=81=E8=AE=B8=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E7=9A=84=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/repository.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index bcd3366cb..ce7ac9d0c 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -38,7 +38,7 @@ class Repository < ActiveRecord::Base validates_length_of :password, :maximum => 255, :allow_nil => true validates_length_of :identifier, :maximum => IDENTIFIER_MAX_LENGTH, :allow_blank => true - validates_presence_of :identifier, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } + validates_presence_of :identifier#, :unless => Proc.new { |r| r.is_default? || r.set_as_default? } validates_uniqueness_of :identifier, :scope => :project_id, :allow_blank => true validates_exclusion_of :identifier, :in => %w(show entry raw changes annotate diff show stats graph) # donwcase letters, digits, dashes, underscores but not digits only From 31e338f1e51e0ad49ce5de17a5c1603253ed4e7c Mon Sep 17 00:00:00 2001 From: nwb Date: Thu, 3 Jul 2014 10:12:30 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=AD=A3http://127.0.0.1:3000/=3F?= =?UTF-8?q?course.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} %>
    diff --git a/config/routes.rb b/config/routes.rb index 2e11d9b43..e4d581f42 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -573,6 +573,7 @@ RedmineApp::Application.routes.draw do end end + match 'projects/course', :to => 'courses#course', :as => 'course' # add by nwb # 课程路由设置 resources :courses do