优化课程首页效率
This commit is contained in:
parent
8724b79296
commit
f7635370d7
|
@ -231,12 +231,12 @@ module WelcomeHelper
|
||||||
# modif by nwb
|
# modif by nwb
|
||||||
def find_all_new_hot_course limit = 9 ,school_id = 0
|
def find_all_new_hot_course limit = 9 ,school_id = 0
|
||||||
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
#sort_project_by_hot_rails 1, 'course_ac_para DESC', limit
|
||||||
time_now = Time.new.strftime("%Y");
|
time_now = Time.new.strftime("%Y")
|
||||||
if school_id
|
if school_id
|
||||||
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id <>
|
courses = Course.includes(:school).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
|
?", school_id).order("course_ac_para DESC").limit(limit).all
|
||||||
else
|
else
|
||||||
courses = Course.visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL
|
courses = Course.includes(:school).visible.joins(:course_status).where("#{Course.table_name}.created_at like '%#{time_now}%' and #{Course.table_name}.school_id is not NULL
|
||||||
").order("course_ac_para DESC").limit(limit).all
|
").order("course_ac_para DESC").limit(limit).all
|
||||||
end
|
end
|
||||||
courses
|
courses
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
<div class='desc_item text_nowrap'>
|
<div class='desc_item text_nowrap'>
|
||||||
[<%= get_course_term course %>]
|
[<%= get_course_term course %>]
|
||||||
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
<%= link_to(course.name.truncate(30, omission: '...'), course_path(course.id), :class => "d-g-blue d-p-project-name", :title => "#{course.name}") %>
|
||||||
(<%= "#{memberCount(course)}人" %>)
|
(<%= course.members.count %>人)
|
||||||
<% files_count = course.attachments.count.to_s %>
|
<%# files_count = course.attachments.count.to_s %>
|
||||||
(<%= link_to "#{files_count}份", course_files_path(course) %>资料)
|
(<%= link_to "#{course.attachments.count.to_s}份", course_files_path(course) %>资料)
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<h1></h1>
|
<h1></h1>
|
||||||
<p id="errorExplanation">
|
<p id="errorExplanation">
|
||||||
该学校未开设任何课程,您可以查看其他学校课程
|
<%= course_title%>
|
||||||
</p>
|
</p>
|
||||||
<h1></h1>
|
<h1></h1>
|
|
@ -91,7 +91,9 @@
|
||||||
<ul class="d-p-projectlist">
|
<ul class="d-p-projectlist">
|
||||||
|
|
||||||
<% if User.current.logged? %>
|
<% if User.current.logged? %>
|
||||||
<%= render "welcome/no_course_title"%>
|
<li>
|
||||||
|
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:lable_school_no_course)} %>
|
||||||
|
</li>
|
||||||
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9, @school_id)} %>
|
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9, @school_id)} %>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10, @school_id)} %>
|
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10, @school_id)} %>
|
||||||
|
@ -113,9 +115,9 @@
|
||||||
<%= render :partial => 'course_list', :locals => {:course_list => school_course} %>
|
<%= render :partial => 'course_list', :locals => {:course_list => school_course} %>
|
||||||
<% if school_course.count < 10 %>
|
<% if school_course.count < 10 %>
|
||||||
<li>
|
<li>
|
||||||
<%= render "welcome/no_course_title"%>
|
<%= render :partial => 'no_course_title', :locals => {:course_title => l(:lable_school_less_course)} %>
|
||||||
</li>
|
</li>
|
||||||
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(10 - school_course.count - 1, @school_id)} %>
|
<%= render :partial => 'course_list', :locals => {:course_list => find_all_new_hot_course(9 - school_course.count, @school_id)} %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -2102,3 +2102,6 @@ zh:
|
||||||
modal_valid_passing: 可以使用
|
modal_valid_passing: 可以使用
|
||||||
label_bug: 漏洞
|
label_bug: 漏洞
|
||||||
|
|
||||||
|
lable_school_no_course: 该学校未开设任何课程,您可以查看其他学校课程
|
||||||
|
lable_school_less_course: 该学校开设课程较少,您可以查看其他学校课程
|
||||||
|
|
Loading…
Reference in New Issue