nwb 2014-07-03 10:12:30 +08:00
parent 70dc5e2b49
commit 31e338f1e5
5 changed files with 11 additions and 4 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

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