修改了个人主页里关注需求全部需求改成只关注的需求
This commit is contained in:
parent
2bd110c550
commit
00cef03049
|
@ -23,14 +23,12 @@ class UsersController < ApplicationController
|
||||||
menu_item :requirement_focus, :only => :watch_bids
|
menu_item :requirement_focus, :only => :watch_bids
|
||||||
menu_item :user_newfeedback, :only => :user_newfeedback
|
menu_item :user_newfeedback, :only => :user_newfeedback
|
||||||
menu_item :user_course, :only => :user_courses
|
menu_item :user_course, :only => :user_courses
|
||||||
menu_item :user_homework, :only => :user_homeworks
|
|
||||||
#Ended by young
|
#Ended by young
|
||||||
|
|
||||||
|
|
||||||
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:update,
|
before_filter :require_admin, :except => [:show, :index, :search, :tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info, :user_watchlist, :user_fanslist,:update, :user_courses]
|
||||||
:user_courses, :user_homeworks]
|
|
||||||
#edit has been deleted by huang, 2013-9-23
|
#edit has been deleted by huang, 2013-9-23
|
||||||
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks,
|
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses,
|
||||||
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
|
:destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids, :info]
|
||||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
||||||
|
|
||||||
|
@ -80,8 +78,7 @@ class UsersController < ApplicationController
|
||||||
##added by fq
|
##added by fq
|
||||||
def watch_bids
|
def watch_bids
|
||||||
cond = 'bids.reward_type <> 1'
|
cond = 'bids.reward_type <> 1'
|
||||||
@bids = Bid.watched_by(@user)
|
@bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
|
||||||
@bids = Bid.visible.where('reward_type = ?', 1) # added by huang
|
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||||
@bid_count = @bids.count
|
@bid_count = @bids.count
|
||||||
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||||
|
@ -125,32 +122,19 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
# end
|
# end
|
||||||
|
|
||||||
# added by huang
|
|
||||||
def user_homeworks
|
|
||||||
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
|
||||||
@memberships = []
|
|
||||||
@membership.each do |membership|
|
|
||||||
if membership.project.project_type == 1
|
|
||||||
@memberships << membership
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@bid = []
|
|
||||||
@memberships.each do |membership|
|
|
||||||
@bid += membership.project.homeworks
|
|
||||||
end
|
|
||||||
@bid = @bid.group_by {|bid| bid.courses.first.id}
|
|
||||||
#add by huang
|
|
||||||
unless User.current.admin?
|
|
||||||
if !@user.active?
|
|
||||||
render_404
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# added by fq
|
# added by fq
|
||||||
def user_courses
|
def user_courses
|
||||||
case params[:type]
|
case params[:type]
|
||||||
|
when "2"
|
||||||
|
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||||
|
@memberships = []
|
||||||
|
@membership.each do |membership|
|
||||||
|
if membership.project.project_type == 1
|
||||||
|
@membership << membership
|
||||||
|
end
|
||||||
|
end
|
||||||
|
@state = 2
|
||||||
|
|
||||||
when "1"
|
when "1"
|
||||||
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||||
@memberships = []
|
@memberships = []
|
||||||
|
@ -229,7 +213,7 @@ class UsersController < ApplicationController
|
||||||
when 'xml', 'json'
|
when 'xml', 'json'
|
||||||
@offset, @limit = api_offset_and_limit({:limit => 15})
|
@offset, @limit = api_offset_and_limit({:limit => 15})
|
||||||
else
|
else
|
||||||
@limit = 15 #per_page_option
|
@limit = 15#per_page_option
|
||||||
end
|
end
|
||||||
|
|
||||||
@status = params[:status] || 1
|
@status = params[:status] || 1
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
|
|
||||||
|
|
||||||
<% if @bid.size > 0%>
|
<% if @bid.size > 0%>
|
||||||
|
|
||||||
<% for bid in @bid %>
|
<% for bid in @bid %>
|
||||||
|
|
||||||
<table width="90%" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px; margin-top: 30px;font-size:14px;">
|
<table width="90%" border="0" align="center" style="border-bottom: 1px dashed rgb(204, 204, 204); margin-bottom: 10px; margin-top: 30px;font-size:14px;">
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'),user_path(bid.author), :class => "avatar" %></td>
|
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'),user_path(bid.author), :class => "avatar" %></td>
|
||||||
|
@ -54,7 +52,6 @@
|
||||||
</table></td>
|
</table></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<!-- fq -->
|
<!-- fq -->
|
||||||
<div class="pagination" style="float:left;">
|
<div class="pagination" style="float:left;">
|
||||||
|
|
Loading…
Reference in New Issue