修改了个人主页里关注需求全部需求改成只关注的需求
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 :user_newfeedback, :only => :user_newfeedback
|
||||
menu_item :user_course, :only => :user_courses
|
||||
menu_item :user_homework, :only => :user_homeworks
|
||||
#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,
|
||||
:user_courses, :user_homeworks]
|
||||
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]
|
||||
#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]
|
||||
accept_api_auth :index, :show, :create, :update, :destroy,:tag_save
|
||||
|
||||
|
@ -79,9 +77,8 @@ class UsersController < ApplicationController
|
|||
|
||||
##added by fq
|
||||
def watch_bids
|
||||
cond = 'bids.reward_type <> 1'
|
||||
@bids = Bid.watched_by(@user)
|
||||
@bids = Bid.visible.where('reward_type = ?', 1) # added by huang
|
||||
cond = 'bids.reward_type <> 1'
|
||||
@bids = Bid.watched_by(@user).where('reward_type = ?', 1) # added by huang
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@bid_count = @bids.count
|
||||
@bid_pages = Paginator.new @bid_count, @limit, params['page']
|
||||
|
@ -125,32 +122,19 @@ class UsersController < ApplicationController
|
|||
end
|
||||
# end
|
||||
|
||||
# added by huang
|
||||
def user_homeworks
|
||||
# added by fq
|
||||
def user_courses
|
||||
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
|
||||
@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
|
||||
def user_courses
|
||||
case params[:type]
|
||||
if membership.project.project_type == 1
|
||||
@membership << membership
|
||||
end
|
||||
end
|
||||
@state = 2
|
||||
|
||||
when "1"
|
||||
@membership = @user.memberships.all(:conditions => Project.visible_condition(User.current))
|
||||
@memberships = []
|
||||
|
@ -229,7 +213,7 @@ class UsersController < ApplicationController
|
|||
when 'xml', 'json'
|
||||
@offset, @limit = api_offset_and_limit({:limit => 15})
|
||||
else
|
||||
@limit = 15 #per_page_option
|
||||
@limit = 15#per_page_option
|
||||
end
|
||||
|
||||
@status = params[:status] || 1
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
|
||||
|
||||
<% if @bid.size > 0%>
|
||||
|
||||
<% 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;">
|
||||
<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>
|
||||
|
@ -54,7 +52,6 @@
|
|||
</table></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<% end %>
|
||||
<!-- fq -->
|
||||
<div class="pagination" style="float:left;">
|
||||
|
@ -64,4 +61,4 @@
|
|||
</div>
|
||||
<% else %>
|
||||
<p class="font_description"><%= l(:label_follow_no_requirement) %></p>
|
||||
<% end %>
|
||||
<% end %>
|
Loading…
Reference in New Issue