课程社区的首页动态,加入班级资源库动态

This commit is contained in:
daiao 2016-12-23 14:03:43 +08:00
parent 1f10a75150
commit fd97d8b421
3 changed files with 58 additions and 54 deletions

View File

@ -2118,7 +2118,7 @@ class UsersController < ApplicationController
shield_course_ids = ShieldActivity.select("shield_id").where("container_type='User' and container_id=#{@user.id} and shield_type='Course'").map(&:shield_id)
@page = params[:page] ? params[:page].to_i + 1 : 0
user_course_ids = (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).empty? ? "(-1)" : "(" + (@user.favorite_courses.visible.where("is_delete = 0").map{|course| course.id}-shield_course_ids).join(",") + ")"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage')"
course_types = "('Message','News','HomeworkCommon','Poll','Course','JournalsForMessage','Attachment')"
principal_types = "JournalsForMessage"
container_type = ''
act_type = ''
@ -2134,6 +2134,9 @@ class UsersController < ApplicationController
when "course_message"
container_type = 'Course'
act_type = 'Message'
when "course_resource"
container_type = 'Course'
act_type = "Attachment"
when "course_poll"
container_type = 'Course'
act_type = 'Poll'

View File

@ -38,75 +38,75 @@
});
</script>
<% if user_activity.act_type == "Project" %>
<%= render :partial => 'project_create', :locals => {:activity => user_activity,:user_activity_id =>user_activity.id} %>
<%= render :partial => 'project_create', :locals => {:activity => user_activity, :user_activity_id => user_activity.id} %>
<% else %>
<% act= user_activity.act %>
<%if act %>
<% case user_activity.container_type.to_s %>
<% when 'Course' %>
<% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %>
<%# cache (act) do %>
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id =>user_activity.id,:hw_status => 1} %>
<% end %>
<%# end %>
<% when 'News' %>
<% act = user_activity.act %>
<% if act %>
<% case user_activity.container_type.to_s %>
<% when 'Course' %>
<% case user_activity.act_type.to_s %>
<% when 'HomeworkCommon' %>
<%# cache (act) do %>
<% hidden_courses = Setting.find_by_name("hidden_courses") %>
<% unvisiable = hidden_courses && hidden_courses.value == "1"%>
<% if !unvisiable %>
<%= render :partial => 'course_homework', :locals => {:activity => act,:user_activity_id => user_activity.id,:hw_status => 1} %>
<% end %>
<%# end %>
<% when 'News' %>
<%# cache [act, act.comments.count] do %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%= render :partial => 'course_news', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%# end %>
<% when 'Message'%>
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
<% when 'Poll' %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<% when 'Course'%>
<% when 'Attachment'%>
<%= render :partial => 'users/course_attachment', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<% when 'Message'%>
<%= render :partial => 'course_message', :locals => {:activity => act,:user_activity_id =>user_activity.id,:is_course=>0,:is_board=>0} %>
<% when 'Poll' %>
<%= render :partial => 'course_poll', :locals => {:activity => act, :user_activity_id => user_activity.id} %>
<% when 'Course'%>
<%# cache (act) do %>
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %>
<%= render :partial => 'users/course_create', :locals => {:activity => act, :user_activity_id => act.id} %>
<%# end%>
<% when 'JournalsForMessage'%>
<% 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 %>
<% when 'Issue' %>
<% end %>
<% when 'Project' %>
<% case user_activity.act_type.to_s %>
<% when 'Issue' %>
<%# cache [act, act.journals.count, act.attachments.count] do%>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %>
<%= render :partial => 'project_issue', :locals => {:activity => act,:user_activity_id =>user_activity.id, :user_id => user_id} %>
<%# end %>
<% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id => user_activity.id, :is_course => 0, :is_board => 0} %>
<% when 'Project'%>
<% when 'Message' %>
<%= render :partial => 'project_message', :locals => {:activity => act,:user_activity_id => user_activity.id, :is_course => 0,:is_board=>0} %>
<% when 'Project'%>
<%# cache (act) do %>
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%# end %>
<% end %>
<% when 'Principal' %>
<% case user_activity.act_type.to_s %>
<% when 'JournalsForMessage' %>
<% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% end %>
<% end %>
<% when 'Blog'%>
<%# cache (act) do %>
<% case user_activity.act_type.to_s %>
<% when 'BlogComment' %>
<%# if !(act.blog.homepage_id and act.id == act.blog.homepage_id) %>
<%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%# end %>
<% end %>
<%= render :partial => 'project_create', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%# end %>
<% end %>
<% end %>
<% when 'Principal' %>
<% case user_activity.act_type.to_s %>
<% when 'JournalsForMessage' %>
<% unless act.private == 1 && (!User.current || (User.current && act.jour_id != User.current.id && act.user_id != User.current.id)) %>
<%= render :partial => 'user_journalsformessage', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<% end %>
<% end %>
<% when 'Blog'%>
<%# cache (act) do %>
<% case user_activity.act_type.to_s %>
<% when 'BlogComment' %>
<%# if !(act.blog.homepage_id and act.id == act.blog.homepage_id) %>
<%= render :partial => 'user_blog', :locals => {:activity => act,:user_activity_id =>user_activity.id} %>
<%# end %>
<% end %>
<%# end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% end %>
<% if user_activities.count == 10%>
<!--
<!--
<div id="show_more_activities" class="loadMore mt10 f_grey">点击展开更多<%#=link_to "", user_activities_path(@user.id,:type => type,:page => page),:id => "more_activities_link",:remote => "true",:class => "none" %></div>
-->
<%= link_to "点击展开更多", action == "project_community" ? user_project_community_path(@user.id, :type => type, :page => page) : (action == "course_community" ? user_course_community_path(@user.id, :type => type,:page => page) : user_activities_path(@user.id,:type => type,:page => page)),

View File

@ -12,6 +12,7 @@
<li><%= link_to @user == User.current ? "我的动态" : "他的动态", {:controller => "users", :action => "course_community", :type => "current_user"}, :class => "homepagePostTypeMine postTypeGrey" %></li>
<li><%= link_to "作业动态", {:controller => "users", :action => "course_community", :type => "course_homework"}, :class => "homepagePostTypeAssignment postTypeGrey" %></li>
<li><%= link_to "通知动态", {:controller => "users", :action => "course_community", :type => "course_news"}, :class => "homepagePostTypeNotice postTypeGrey" %></li>
<li><%= link_to "资源库动态", {:controller => "users", :action => "course_community", :type => "course_resource"}, :class => "homepagePostTypeNotice postTypeGrey" %></li>
<li><%= link_to "论坛动态", {:controller => "users", :action => "course_community", :type => "course_message"}, :class => "homepagePostTypeForum postTypeGrey" %></li>
<li><%= link_to "问卷动态", {:controller => "users", :action => "course_community", :type => "course_poll"}, :class => "homepagePostTypeQuiz postTypeGrey" %></li>
<li><%= link_to "班级留言", {:controller => "users", :action => "course_community", :type => "course_journals"}, :class => "homepagePostTypeMessage postTypeGrey" %></li>