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)%>
<%= render_project_hierarchy(@projects)%>
diff --git a/app/views/welcome/course.html.erb b/app/views/welcome/course.html.erb
index 286ff60d..005f5371 100644
--- a/app/views/welcome/course.html.erb
+++ b/app/views/welcome/course.html.erb
@@ -1,197 +1,204 @@
<%= stylesheet_link_tag 'welcome' %>
<%= javascript_include_tag 'welcome' %>
-
- <%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
-
微信扫码
-
-
-
- <%= image_tag(@logoLink, size:'75x75') %>
+
+ <%= image_tag '/images/qrweixin.jpg', size: '150x150', alt: 'trustie', class: "weixin" %>
+
微信扫码
+
+
+
+ <%= image_tag(@logoLink, size:'75x75') %>
-
-
-
+
+
+
<% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
- <% else%>
+ <% else%>
<% if params[:school_id] == "0" %>
- <% else %>
+ <% else %>
<% if params[:school_id].nil? %>
<%= link_to School.find(User.current.user_extensions.school.id).name, options={:action => 'course',:school_id => User.current.user_extensions.school.id}, html_options={:class => 'font_welcome_school',:method => 'get'}%>
-
+
<% else %>
<%= link_to School.find(params[:school_id]).name ,options={:action => 'course',:school_id => params[:school_id]}, html_options={:class => 'font_welcome_school',:method => 'get'}%>
-
+
<% end %>
<% end %>
<% end %>
- <%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %>
- <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
- , <%= l(:label_welcome_trustie_course_description) %>
- <% else %>
- <% if params[:school_id] == "0" %>
- , <%= l(:label_welcome_trustie_course_description) %>
- <% end %>
- <% end %>
-
-
- <%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%>
-
-
-
+
<%= l(:label_welcome_trustie) %><%= l(:label_welcome_trustie_course) %>
+ <% if params[:school_id].nil? and User.current.user_extensions.school.nil? %>
+
, <%= l(:label_welcome_trustie_course_description) %>
+ <% else %>
+ <% if params[:school_id] == "0" %>
+
, <%= l(:label_welcome_trustie_course_description) %>
+ <% end %>
+ <% end %>
+
+
+ <%= render :partial => "search_project", :locals => {:project_type => Project::ProjectType_course}%>
+
+
+
-
+
-
新开课程
-
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %>
-
-
+ 新开课程
+ <% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %>
+ <%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => nil} %>
+
+
-
-
- <% if(find_miracle_course(10, 7,params[:school_id]).map.count == 0) %>
-
-
- 该学校未开设任何课程,您可以查看其他学校课程
-
-
- <% find_all_hot_course(9).map do |project| %>
- - >
-
- <%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
-
-
-
- [<%= get_course_term project %>]
- <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
- (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
- <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
- (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
-
-
-
- <% course = Course.find_by_extra(project.identifier)%>
- <% if(course.school == nil) %>
-
- <% else %>
- <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
- <% end %>
-
-
- <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
- <%#=course.try(:teacher).try(:name)%>
-
-
-
-
- <% if !course_endTime_timeout?(project)%>
-
- <%= join_in_course(project, User.current)%>
-
- <% end %>
-
-
- <% end %>
- <% else %>
- <% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
- - >
-
- <%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
-
-
-
- [<%= get_course_term project %>]
- <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
- (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
- <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
- (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
-
-
-
- <% course = Course.find_by_extra(project.identifier) %>
- <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
-
-
- <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
+
+
+
+
+ 该学校未开设任何课程,您可以查看其他学校课程
+
+
+ <% find_all_new_hot_course(9).map do |project| %>
+ - >
+
+ <%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
+
+
+
+
+ <% course = Course.find_by_extra(project.identifier)%>
+ <% if(course.school == nil) %>
+
+ <% else %>
+ <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
+ <% end %>
+
+
+ <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
<%#=course.try(:teacher).try(:name)%>
-
-
-
-
- <% if !course_endTime_timeout?(project)%>
-
- <%= join_in_course(project, User.current)%>
-
- <% end %>
-
-
- <% end; reset_cycle %>
+
+
+
+ [<%= get_course_term project %>]
+ <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
+ (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
+ <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
+ (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
+
+
+
+ <% if !course_endTime_timeout?(project)%>
+
+ <%= new_watcher_link(project, User.current)%>
+
+ <% end %>
+
+
<% end %>
-
-
+
+
+ <% else %>
+
<%= link_to "更多>>", {:controller => 'projects', :action => 'course', :project_type => 1, :school_id => params[:school_id]} %>
+
+
+
+ <% find_miracle_course(10, 7,params[:school_id]).map do |project| %>
+ - >
+
+ <%= image_tag(get_course_avatar(project), :class => "avatar-4") %>
+
+
+
+
+ <% course = Course.find_by_extra(project.identifier) %>
+ <%= course.school.name.try(:gsub, /(.+)$/, '\1:') %>
+
+
+ <%= link_to(course.try(:teacher).try(:name), user_path(course.teacher)) %>
+ <%#=course.try(:teacher).try(:name)%>
+
+
+
+ [<%= get_course_term project %>]
+ <%= link_to( project.name, project_path(project.id), :class => "d-g-blue d-p-project-name",:title => "#{project.name}" )%>
+ (<%= link_to "#{studentCount(project)}人", project_member_path(project, :role => 2) ,:course =>'1' %>)
+ <% files_count = (project.attachments.count.to_i+Version.joins(:project).where("projects.id=#{project.id}").count.to_i).to_s %>
+ (<%=link_to "#{files_count}份", project_files_path(project) %>资料)
+
+
+
+ <% if !course_endTime_timeout?(project)%>
+
+ <%= join_in_course(project, User.current)%>
+
+ <% end %>
+
+
+ <% end; reset_cycle %>
+
+
+ <% end %>
-
- 问题和反馈动态
- <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
- <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
-
-
<%= link_to "更多>>", forums_path %>
-
-
- <% find_new_forum_topics(10).each do |topic|%>
- -
-
+
+ 问题和反馈动态
+ <%= link_to "我要提问" , newbie_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
+ <%= link_to "我要反馈" , suggestion_send_path, {:class => 'orangeButton idea_btn', :style => "color: #EEEEEE" }%>
+
+
<%= link_to "更多>>", forums_path %>
+
+
+ <% find_new_forum_topics(10).each do |topic|%>
+ -
+
<%= link_to '['+topic.forum.name + ']',forum_path(topic.forum),:class => 'memo_Bar_title' %><%= link_to topic.subject.truncate(30, omission: '...'), topic.event_url, :class => "gray" , :style => "font-size: 10pt !important;" %>
-
- <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前
+
+ <%= l(:field_updated_on) %><%=time_tag_welcome(topic_last_time topic)%>前
由 <%= link_to topic.author ? topic.author : 'Anonymous', user_path(topic.author_id), :style => "font-size: 9pt !important; color: rgb(17, 102, 173);" %> 发表
- 回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)
-
-
- <% end %>
-
-
+
回复(<%= link_to (topic.parent ? topic.parent.replies_count : topic.replies_count), topic.event_url %>)
+
+
+ <% end %>
+
+
-
-
-
- 当前网站状态 |
- 活跃课程: <%=@courseCount%> |
- 高校: 2个 |
- 教师: <%=@teacherCount%> 名 |
- 学生: <%=@studentCount%> 名 |
- |
-
-
+
+
+
+ 当前网站状态 |
+ 活跃课程: <%=@courseCount%> |
+ 高校: 2个 |
+ 教师: <%=@teacherCount%> 名 |
+ 学生: <%=@studentCount%> 名 |
+ |
+
+
\ No newline at end of file