Merge remote-tracking branch 'origin/szzh' into szzh

This commit is contained in:
sw 2014-07-03 10:33:35 +08:00
commit 3c7e680b1b
6 changed files with 12 additions and 5 deletions

View File

@ -473,7 +473,11 @@ module ApplicationHelper
def principals_check_box_tags_ex(name, principals)
s = ''
principals.each do |principal|
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
if principal.has_attribute?(:userInfo)
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal.userInfo }</label>\n"
else
s << "<label>#{ check_box_tag name, principal.id, false, :id => nil } #{h principal}</label>\n"
end
end
s.html_safe
end

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -75,7 +75,7 @@
<h3><strong>新开课程</strong></h3>
<% school_course = find_miracle_course(10, 7,params[:school_id]) %>
<% if(school_course.count == 0) %>
<span><%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %></span>
<span><%= link_to "更多>>", {:controller => 'courses', :action => 'course', :project_type => 1, :school_id => nil} %></span>
<div class="d-p-projectlist-box">
<ul class="d-p-projectlist">

View File

@ -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