网站首页、个人主页、项目、课程等页面header项目/课程下拉框按照最新的动态更新时间排序
This commit is contained in:
parent
11ad8d6d42
commit
b036d5b63d
|
@ -1812,7 +1812,7 @@ module ApplicationHelper
|
|||
#获取用户未过期的课程
|
||||
def get_user_course user
|
||||
courses_doing = []
|
||||
user.courses.each do |course|
|
||||
user.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course|
|
||||
if !course_endTime_timeout?(course)
|
||||
courses_doing.push course
|
||||
end
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<ul class="sub_menu">
|
||||
<% if @show_course == 1 && !visiable %>
|
||||
<% hasCourse=false %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<% hasCourse=true %>
|
||||
<% break %>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_courses', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的课程</a>
|
||||
<ul>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% User.current.courses.select("courses.*,(SELECT MAX(created_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<li title="<%=course.name%>"><a href="<%= url_for(:controller => 'courses', :action=>"show", :id=>course.id, :host=>Setting.host_course) %>"><%= course.name %></a>
|
||||
<% end %>
|
||||
|
@ -41,8 +41,12 @@
|
|||
<li>
|
||||
<a href="<%= url_for(:controller => 'users', :action => 'user_projects', :id=>User.current.id, :host=>Setting.host_user) %>" class="parent">我的项目</a>
|
||||
<ul>
|
||||
<% User.current.projects.each do |project| %>
|
||||
<li title="<%=project.name%>"><a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>"><%=project.name%></a></li>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
|
||||
<li title="<%=project.name%>">
|
||||
<a href="<%= url_for(:controller => 'projects', :action=>"show", :id=>project.id, :host=>Setting.host_name) %>">
|
||||
<%=project.name%>
|
||||
</a>
|
||||
</li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</li>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<li id="my_courses_li">
|
||||
<%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent" %>
|
||||
<ul id="my_courses_ul">
|
||||
<% user_course.reverse.each do |course| %>
|
||||
<% user_course.each do |course| %>
|
||||
<li title="<%=course.name%>">
|
||||
<%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
|
||||
</li>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<li id="my_projects_li">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
|
||||
<ul id="my_projects_ul" >
|
||||
<% User.current.projects.reverse.each do |project| %>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
|
||||
<li title="<%=project.name%>">
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
|
||||
</li>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<ul class="course_sub_menu">
|
||||
<% course_index = 0 %>
|
||||
|
||||
<% User.current.courses.reverse.each do |course| %>
|
||||
<% User.current.courses.each do |course| %>
|
||||
<% if !course_endTime_timeout?(course) %>
|
||||
<%= render :partial => 'layouts/user_homework_list', :locals => {:course => course,:course_index => course_index} %>
|
||||
<% course_index += 1 %>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<li id="project_loggedas_li" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;">
|
||||
<%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name} %>
|
||||
<ul class="project_sub_menu" style="top:<%= hasCourse ? 35 : 0 %>px;">
|
||||
<% User.current.projects.reverse.each do |project| %>
|
||||
<% User.current.projects.select("projects.*,(SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
|
||||
<li style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;" title="<%=project.name%>">
|
||||
<%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name } %>
|
||||
</li>
|
||||
|
|
Loading…
Reference in New Issue