Merge branch 'develop' into yuanke
This commit is contained in:
commit
7be7bfb3f7
|
@ -24,7 +24,7 @@ module CoursesHelper
|
|||
def find_excelletn_course keywords, current_course
|
||||
# 获取tag匹配结果ID
|
||||
a_tags = []
|
||||
Course.where("is_excellent =? and is_public =?", 1, 1).includes(:tags).each do |ec|
|
||||
Course.where("is_excellent =? and is_public =?", 1, 1).each do |ec|
|
||||
if ec.tags.any?{|value| current_course.name.include?(value.to_s)}
|
||||
a_tags << ec.id
|
||||
end
|
||||
|
|
|
@ -204,12 +204,18 @@
|
|||
<% end%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% course_order_ids = "(" +
|
||||
<% if @user.courses.visible.count > 0
|
||||
course_order_ids = "(" +
|
||||
CourseActivity.find_by_sql("SELECT c.course_id, updated_at FROM
|
||||
(SELECT ca.course_id, MAX(ca.updated_at) AS updated_at FROM course_activities ca WHERE ca.course_id IN (" + @user.courses.visible.select('courses.id').map{|c| c.id}.join(',') + ")
|
||||
GROUP BY ca.course_id) AS c
|
||||
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"%>
|
||||
<% courses = Course.where("id in #{course_order_ids}")%>
|
||||
ORDER BY c.updated_at DESC limit 5").map {|c| c.course_id}.join(",") + ")"
|
||||
courses = Course.where("id in #{course_order_ids}")
|
||||
else
|
||||
courses = []
|
||||
|
||||
end
|
||||
%>
|
||||
<%# courses = @user.courses.visible.where("is_delete =?", 0).select("courses.*,(SELECT MAX(updated_at) FROM `course_activities` WHERE course_activities.course_id = courses.id) AS a").order("a desc").limit(5) %>
|
||||
<div class="homepageLeftMenuCourses <%= courses.empty? ? 'none' : ''%>" id="homepageLeftMenuCourses">
|
||||
<ul>
|
||||
|
@ -223,13 +229,18 @@
|
|||
<%=link_to "", new_project_path(:host=> Setting.host_name), :class => "homepageMenuSetting fr", :style => "margin-right:10px;", :title => "新建项目"%>
|
||||
<% end%>
|
||||
</div>
|
||||
<% project_order_ids = "(" +
|
||||
<% if @user.projects.visible.count > 0
|
||||
project_order_ids = "(" +
|
||||
ForgeActivity.find_by_sql("SELECT p.project_id, p.created_at FROM
|
||||
(SELECT fa.project_id, MAX(fa.created_at) AS created_at FROM forge_activities fa WHERE fa.project_id IN (" + @user.projects.visible.select('projects.id').map{|p| p.id}.join(',') + ")
|
||||
GROUP BY fa.project_id) AS p
|
||||
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"%>
|
||||
<%# project_order_ids = "(" + ForgeActivity.select("DISTINCT project_id, max(created_at) as max_created_at").where("project_id in #{"(" + @user.projects.visible.select("projects.id").map{|p| p.id}.join(",") + ")"}").order("max_created_at desc").map {|p| p.project_id}.join(",") + ")"%>
|
||||
<% projects = Project.where("projects.id in #{project_order_ids}")%>
|
||||
ORDER BY p.created_at DESC limit 5").map {|p| p.project_id}.join(",") + ")"
|
||||
projects = Project.where("projects.id in #{project_order_ids}")
|
||||
else
|
||||
projects = []
|
||||
end
|
||||
%>
|
||||
|
||||
<%# projects = @user.projects.visible.select("projects.*, (SELECT MAX(created_at) FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").limit(5)%>
|
||||
<div class="homepageLeftMenuCourses <%= projects.empty? ? 'none' : ''%>" id="homepageLeftMenuForge">
|
||||
<ul>
|
||||
|
|
|
@ -35,14 +35,15 @@
|
|||
<div class="homepageRightBanner" style="margin-top:<%= User.current.logged? ? '0px':'10px' %>; margin-bottom:10px;">
|
||||
<div class="NewsBannerName"><%= OrgSubfield.try(:find, params[:field_id]).try(:name) %></div>
|
||||
</div>
|
||||
<div class="resources" nhname="new_topic_form" style="padding-top:<%= params[:field_id].present? ? '0px': '15px' %>">
|
||||
<div class="resources" nhname="new_topic_form" >
|
||||
<%= form_tag organization_org_document_comments_path(:organization_id => @organization.id, :field_id => params[:field_id]), :id => 'new_org_document_form' do |f| %>
|
||||
<div>
|
||||
<textarea class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题"></textarea>
|
||||
<input class="postDetailInput fl mr15" style="margin-bottom:15px;" name="org_document_comment[title]" id="document_title" style="resize:none;" onfocus = "$('#org_document_editor').show();" placeholder="请输入文章标题"></input>
|
||||
</div>
|
||||
<div id="doc_title_hint">
|
||||
</div>
|
||||
<div class="mt15" >
|
||||
<div class="cl"></div>
|
||||
<div class="" >
|
||||
<div class="mt10">
|
||||
<textarea placeholder="有问题或有建议,请直接给我留言吧!" style="display: none" nhname='description_textarea' name="org_document_comment[content]"></textarea>
|
||||
<%#= kindeditor_tag 'org_document_comment[content]','', :editor_id => 'org_document_description_editor', :height => "150px" %>
|
||||
|
|
|
@ -79,6 +79,8 @@
|
|||
<% cache (act) do %>
|
||||
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %>
|
||||
<%end%>
|
||||
<% when 'JournalsForMessage'%>
|
||||
<%= render :partial => 'users/course_journalsformessage', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
|
||||
<% end %>
|
||||
<% when 'Project' %>
|
||||
<% case user_activity.act_type.to_s %>
|
||||
|
|
Loading…
Reference in New Issue