1、课程动态、每次项目动态显示13条

2、取消动态页面、他的课程、他的项目、留言等显示
This commit is contained in:
sw 2015-07-28 16:04:40 +08:00
parent 5dc3eba27a
commit 9728277005
3 changed files with 5 additions and 159 deletions

View File

@ -426,95 +426,6 @@ class UsersController < ApplicationController
render :layout=>nil
end
# def user_course_activities
# @list = []
# lastid = nil
# if params[:lastid]!=nil && !params[:lastid].empty?
# lastid = params[:lastid];
# end
#
# user_ids = []
# if @user == User.current
# watcher = User.watched_by(@user)
# watcher.push(User.current)
# user_ids = watcher.map{|x| x.id}
# else
# user_ids << @user.id
# end
#
# query_rec_count = 8
# query_times = 10 #query_times次没查到query_rec_count条记录就不查了
# query_i = 0;
# while( true )
# query_i = query_i+1
# if(query_i>query_times)
# break
# end
# query = Activity.where(user_id: user_ids)
# if(lastid != nil)
# query = query.where("id < ?",lastid)
# end
# lastid,item_list = query_activities(query,'course');
# for item in item_list
# @list << item
# if @list.count() >= query_rec_count
# break
# end
# end
# if @list.count() >= query_rec_count
# break
# end
# if lastid == nil
# break
# end
# end
# render :layout=>nil
# end
#
# def user_project_activities
# @list = []
# lastid = nil
# if params[:lastid]!=nil && !params[:lastid].empty?
# lastid = params[:lastid];
# end
#
# user_ids = []
# if @user == User.current
# watcher = User.watched_by(@user)
# watcher.push(User.current)
# user_ids = watcher.map{|x| x.id}
# else
# user_ids << @user.id
# end
#
# query_rec_count = 8
# query_times = 10 #query_times次没查到query_rec_count条记录就不查了
# query_i = 0;
# while( true )
# query_i = query_i+1
# if(query_i>query_times)
# break
# end
# query = Activity.where(user_id: user_ids)
# if(lastid != nil)
# query = query.where("id < ?",lastid)
# end
# lastid,item_list = query_activities(query,'project');
# for item in item_list
# @list << item
# if @list.count() >= query_rec_count
# break
# end
# end
# if @list.count() >= query_rec_count
# break
# end
# if lastid == nil
# break
# end
# end
# render :action=>'user_course_activities',:layout=>nil
# end
def user_course_activities
lastid = nil
if params[:lastid]!=nil && !params[:lastid].empty?
@ -573,7 +484,7 @@ class UsersController < ApplicationController
query = query.where("#{Activity.table_name}.id < ?",lastid)
end
query = query.order("#{Activity.table_name}.id desc")
@list = query_activities(query);
@list = query_activities(query)
render :action=>'user_course_activities',:layout=>nil
end

View File

@ -364,14 +364,15 @@ module UsersHelper
end
def query_activities(query)
list = query.limit(8).all
result = [];
list = query.limit(13).all
result = []
for item in list
container = get_activity_container(item)
result << { :item=>item,:e=>container }
end
return result
result
end
def get_activity_container activity
return activity.activity_container
end

View File

@ -29,49 +29,6 @@
<% end %>
<div id="RSide" class="fl">
<div class="message_box mb10">
<div nhname='new_message' style="display:none;">
<form action="<%= url_for(:controller => 'words', :action => 'create', :user_id => @user.id) %>" data-remote="true" method="post">
<textarea placeholder="有问题或有建议,请直接给我留言吧!" nhname='new_message_textarea' name="new_form[user_message]"></textarea>
<p nhname='contentmsg'></p>
<div nhname='toolbar_container' style="float:left;padding-top:3px;"></div>
<a id="new_message_cancel_btn" href="javascript:void(0)" class="grey_n_btn fr " style="margin-top:3px;">取消</a>
<a id="new_message_submit_btn" href="javascript:void(0)" class="blue_n_btn fr mr5 " style="margin-top:3px;">留言</a>
</form>
</div>
<div class="cl"></div>
<div class="message_list_box" nhname="list_more_div" id="nh_messages" style="display:none;">
<div nhname="container" data-nodatamsg="暂无留言" data-pagesize="3" data-url="<%= url_for(:controller => 'users', :action => 'user_feedback4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
<div class="message_list_more" style="width:700px">
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr mr10">收起</a>
<div class="cl"></div>
</div>
</div>
</div>
<% if !@center_flag %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<div class="users_top">
<a href="<%=url_for(:controller => 'users', :action => 'user_courses')%>" class="f14 fb fl c_dark ml10 mt8"><%= @center_flag ? '我的课程' : 'TA的课程' %></a>
<% if @center_flag %>
<% if @user.user_extensions.identity == 0 && @user.allowed_to?(:add_course, nil, :global => true) %>
<a href="<%= url_for(:controller => 'courses', :action => 'new',:host=>Setting.host_course) %>" class=" green_u_btn fr mt8 mr8" target="_blank">新建课程</a>
<% else %>
<a href="<%= join_private_courses_courses_path %>" data-remote ="true" class=" green_u_btn fr mt8 mr8">加入课程</a>
<% end %>
<% end %>
</div>
<div class="cl"></div>
<div nhname="container" data-nodatamsg="暂无课程" data-url="<%= url_for(:controller => 'users', :action => 'user_courses4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
<div class="cl"></div>
<div class="message_list_more mt10">
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<h4 class="users_h4">课程动态</h4>
@ -82,29 +39,6 @@
</div>
</div>
<% if !@center_flag %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<div class=" users_top">
<a href="<%=url_for(:controller => 'users', :action => 'user_projects')%>" class="f14 fb fl c_dark ml10 mt8"><%= @center_flag ? '我的项目' : 'TA的项目' %></a>
<% if @center_flag %>
<% if @user.allowed_to?(:add_project, nil, :global => true) %>
<a href="<%= url_for(:controller => 'projects', :action => 'new',:host=>Setting.host_name) %>" class=" green_u_btn fr mt8 mr8" target="_blank">新建项目</a>
<% else %>
<a href="<%= join_project_projects_path %>" data-remote ="true" class=" green_u_btn fr mt8 mr8">加入项目</a>
<% end %>
<% end %>
</div>
<div class="cl"></div>
<div nhname="container" data-nodatamsg="暂无项目" data-url="<%= url_for(:controller => 'users', :action => 'user_projects4show') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>
<div class="cl"></div>
<div class="message_list_more mt10">
<a nhname="expand" href="javascript:void(0)" class="c_blue02">点击展开更多</a> <a nhname="close" style="display:none" href="javascript:void(0)" class="c_lgrey fr">收起</a>
<div class="cl"></div>
</div>
<div class="cl"></div>
</div>
<% end %>
<div class="users_courses_box line_box mb10" nhname="list_more_div" style="display:none;">
<h4 class="users_h4">项目动态</h4>
<div nhname="container" data-nodatamsg="暂无动态" data-url="<%= url_for(:controller => 'users', :action => 'user_project_activities') %>" data-isclose="0" data-currpage="0" data-hasmore="1"></div>