修改课程首页课程列表显示策略
This commit is contained in:
parent
394beedcc2
commit
805de7fc28
|
@ -62,10 +62,46 @@ class WelcomeController < ApplicationController
|
|||
@course_page = FirstPage.find_by_page_type('course')
|
||||
@school_id = params[:school_id] || User.current.user_extensions.school.try(:id)
|
||||
@logoLink ||= logolink()
|
||||
|
||||
##3-8月份为查找春季课程,9-2月份为查找秋季课程
|
||||
#month_now = Time.now.strftime("%m").to_i
|
||||
#year_now = Time.new.strftime("%Y").to_i
|
||||
#(month_now >= 3 && month_now < 9) ? course_term = l(:label_spring) : course_term = l(:label_autumn)
|
||||
##year_now -= 1 if year_now < 3
|
||||
#@school_id.nil? ? @cur_school_course = [] : @cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term)
|
||||
##未登录或者当前学校未开设课程
|
||||
#if @cur_school_course.empty?
|
||||
# @has_course = false
|
||||
# User.current.logged? ? course_count = 9 : course_count = 10
|
||||
# @cur_school_course += find_all_new_hot_course(course_count, @school_id, year_now, course_term)
|
||||
# while @cur_school_course.count < 9 do
|
||||
# if course_term == l(:label_spring)
|
||||
# course_term = l(:label_autumn)
|
||||
# year_now -= 1
|
||||
# else
|
||||
# course_term = l(:label_spring)
|
||||
# end
|
||||
# @cur_school_course += find_all_new_hot_course((10-@cur_school_course.count), nil, year_now, course_term)
|
||||
# end
|
||||
#else
|
||||
# if @cur_school_course.count < 9
|
||||
# @has_course = false
|
||||
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, @school_id, year_now, course_term)
|
||||
# if @cur_school_course.count < 9
|
||||
# if course_term == l(:label_spring)
|
||||
# course_term = l(:label_autumn)
|
||||
# year_now -= 1
|
||||
# else
|
||||
# course_term = l(:label_spring)
|
||||
# end
|
||||
# @cur_school_course += find_all_new_hot_course(9-@cur_school_course.count, nil, year_now, course_term)
|
||||
# end
|
||||
# else
|
||||
# @has_course = true
|
||||
# end
|
||||
#end
|
||||
end
|
||||
|
||||
|
||||
|
||||
def logolink()
|
||||
@course_page = FirstPage.find_by_page_type('course')
|
||||
logo = get_avatar?(@course_page)
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
</h3>
|
||||
|
||||
<% month_now = Time.now.strftime("%m").to_i %>
|
||||
<% year_now = 2014 %>
|
||||
<% year_now = Time.new.strftime("%Y").to_i %>
|
||||
<!-- 3-8月份为查找春季课程,9-2月份为查找秋季课程 -->
|
||||
<% (month_now >= 3 && month_now < 9) ? course_term = "春季学期" : course_term = "秋季学期" %>
|
||||
<% @school_id.nil? ? cur_school_course = [] : cur_school_course = find_miracle_course(10,7,@school_id, year_now, course_term) %>
|
||||
|
@ -107,7 +107,17 @@
|
|||
</li>
|
||||
<% end %>
|
||||
<% User.current.logged? ? course_count = 9 : course_count = 10 %>
|
||||
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(course_count, @school_id, year_now, course_term)} %>
|
||||
<% all_new_hot_course = find_all_new_hot_course(course_count, @school_id, year_now, course_term)%>
|
||||
<% while all_new_hot_course.count < course_count%>
|
||||
<% if course_term == "春季学期"
|
||||
year_now -= 1
|
||||
course_term = "秋季学期"
|
||||
else
|
||||
course_term = "春季学期"
|
||||
end%>
|
||||
<% all_new_hot_course += find_all_new_hot_course(course_count-all_new_hot_course.count, @school_id, year_now, course_term)%>
|
||||
<% end%>
|
||||
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
||||
</ul>
|
||||
</div>
|
||||
<% else %>
|
||||
|
@ -127,7 +137,17 @@
|
|||
<li>
|
||||
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:label_school_less_course)} %>
|
||||
</li>
|
||||
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)} %>
|
||||
<% all_new_hot_course = find_all_new_hot_course(9-cur_school_course.count, @school_id, year_now, course_term)%>
|
||||
<% while (all_new_hot_course.count + cur_school_course.count) < 9%>
|
||||
<% if course_term == "春季学期"
|
||||
year_now -= 1
|
||||
course_term = "秋季学期"
|
||||
else
|
||||
course_term = "春季学期"
|
||||
end%>
|
||||
<% all_new_hot_course += find_all_new_hot_course(9-(all_new_hot_course.count + cur_school_course.count), @school_id, year_now, course_term)%>
|
||||
<% end%>
|
||||
<%= render :partial => 'course_list', :locals => {:course_list => all_new_hot_course} %>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -2179,7 +2179,7 @@ zh:
|
|||
modal_valid_passing: 可以使用
|
||||
label_bug: 漏洞
|
||||
|
||||
label_school_no_course: 该学校未开设任何课程,您可以查看其他学校课程
|
||||
label_school_no_course: 该学校本学期未开设任何课程,您可以查看其他学校课程
|
||||
label_school_less_course: 您也可以查看其他学校课程
|
||||
|
||||
label_file_not_found: 对不起,该文件现在不能下载
|
||||
|
|
Loading…
Reference in New Issue