首页、课程社区、项目社区的点击展开更多
This commit is contained in:
parent
b661593e29
commit
2275a0ecae
|
@ -2128,12 +2128,6 @@ class UsersController < ApplicationController
|
|||
when "course_journals"
|
||||
container_type = 'Course'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "user_journals"
|
||||
container_type = 'Principal'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "current_user"
|
||||
container_type = 'Principal'
|
||||
act_type = 'Principal'
|
||||
when "all"
|
||||
container_type = 'all'
|
||||
act_type = 'all'
|
||||
|
@ -2142,23 +2136,12 @@ class UsersController < ApplicationController
|
|||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Course'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_course_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and (container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
end
|
||||
else
|
||||
if User.current != @user
|
||||
blog_ids = "("+@user.blog.id.to_s+")"
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
end
|
||||
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})" +
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||
sql = "(container_type = 'Course' and container_id in #{user_course_ids} and act_type in #{course_types})"
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
|
@ -2191,12 +2174,6 @@ class UsersController < ApplicationController
|
|||
when "project_message"
|
||||
container_type = 'Project'
|
||||
act_type = 'Message'
|
||||
when "user_journals"
|
||||
container_type = 'Principal'
|
||||
act_type = 'JournalsForMessage'
|
||||
when "current_user"
|
||||
container_type = 'Principal'
|
||||
act_type = 'Principal'
|
||||
when "all"
|
||||
container_type = 'all'
|
||||
act_type = 'all'
|
||||
|
@ -2205,23 +2182,12 @@ class UsersController < ApplicationController
|
|||
if container_type != '' && container_type != 'all'
|
||||
if container_type == 'Project'
|
||||
sql = "container_type = '#{container_type}' and container_id in #{user_project_ids} and act_type = '#{act_type}'"
|
||||
elsif container_type == 'Principal' && act_type == 'JournalsForMessage'
|
||||
sql = "container_type = '#{container_type}' and act_type= '#{act_type}' and container_id = #{@user.id}"
|
||||
elsif container_type == 'Principal' && act_type == 'Principal'
|
||||
sql = "user_id = #{@user.id} and ((container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types}))"
|
||||
end
|
||||
if User.current != @user
|
||||
sql += " and user_id = #{@user.id}"
|
||||
end
|
||||
else
|
||||
if User.current != @user
|
||||
blog_ids = "("+@user.blog.id.to_s+")"
|
||||
else
|
||||
blog_ids = "("+@user.blog.id.to_s+","+((User.watched_by(@user.id).count == 0 )? '0' :User.watched_by(@user.id).map{|u| u.blog.id}.join(','))+")"
|
||||
end
|
||||
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})" +
|
||||
"or (container_type = 'Principal' and act_type= '#{principal_types}' and container_id = #{@user.id}) " +
|
||||
"or (container_type = 'Blog' and act_type= 'BlogComment' and container_id in #{blog_ids})"
|
||||
sql = "(container_type = 'Project' and container_id in #{user_project_ids} and act_type in #{project_types})"
|
||||
if container_type != 'all' && User.current != @user
|
||||
sql = "user_id = #{@user.id} and(" + sql + ")"
|
||||
end
|
||||
|
|
|
@ -82,13 +82,13 @@
|
|||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="user_leftnav ">
|
||||
<ul class="users_accordion mb10">
|
||||
<li id="user_10" class="user_icons_mes">
|
||||
<%= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--<div class="user_leftnav ">-->
|
||||
<!--<ul class="users_accordion mb10">-->
|
||||
<!--<li id="user_10" class="user_icons_mes">-->
|
||||
<!--<%#= link_to '留言', feedback_path(@user, :host=> Setting.host_user)%>-->
|
||||
<!--</li>-->
|
||||
<!--</ul>-->
|
||||
<!--</div>-->
|
||||
<%# 更新访问数,刷新的时候更新访问次数 %>
|
||||
<% update_visiti_count @user %>
|
||||
<div class="fontGrey5 mt10 ml20">访问计数 <%= @user.visits.to_i %> (自2016年5月)</div>
|
||||
|
|
|
@ -109,7 +109,8 @@
|
|||
<!--
|
||||
<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 "点击展开更多", user_activities_path(@user.id,:type => type,:page => page), :id => "show_more_activities", :remote => "true", :class => "loadMore mt10 f_grey"%>
|
||||
<%= 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)),
|
||||
:id => "show_more_activities", :remote => "true", :class => "loadMore mt10 f_grey" %>
|
||||
<% end%>
|
||||
|
||||
<!--
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<%# end %>
|
||||
<% if @user_activities_count > 0 %>
|
||||
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type,
|
||||
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %>
|
||||
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "course_community" } %>
|
||||
<% else %>
|
||||
<div class="mb10">
|
||||
<%= render :partial => 'users/no_data' %>
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
<%# end %>
|
||||
<% if @user_activities_count > 0 %>
|
||||
<%= render :partial => 'users/user_activities', :locals => { :user_activities => @user_activities, :page => 0, :type => @type,
|
||||
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => params[:action] } %>
|
||||
:user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "project_community" } %>
|
||||
<% else %>
|
||||
<div class="mb10">
|
||||
<%= render :partial => 'users/no_data' %>
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
</div>
|
||||
<!--显示个人主页-->
|
||||
<% if @user_activities_count > 0 %>
|
||||
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} %>
|
||||
<%= render :partial => 'users/user_activities', :locals => {:user_activities => @user_activities, :page => 0, :type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} %>
|
||||
<% else %>
|
||||
<div class="mb10">
|
||||
<%= render :partial => 'users/no_data' %>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<% if is_current_user %>
|
||||
$("#user_homepage_message_list").html("<%= escape_javascript( render :partial => 'users/user_message_list') %>");
|
||||
<% else %>
|
||||
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id)} )%>");
|
||||
$("#show_more_activities").replaceWith("<%= escape_javascript( render :partial => 'users/user_activities',:locals => {:user_activities => @user_activities, :page => @page,:type => @type, :user_id => (@user.type == "AnonymousUser" ? User.current.id : @user.id), :action => "user_activities"} )%>");
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue