修改了作业列表无法显示
This commit is contained in:
parent
00cef03049
commit
19ebd48a95
|
@ -23,12 +23,14 @@ 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, :onlu => :user_courses
|
||||||
|
|
||||||
#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, :user_courses]
|
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]
|
||||||
#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,
|
before_filter :find_user, :only => [:user_fanslist, :user_watchlist, :show, :edit, :update, :destroy, :edit_membership, :user_courses, :user_homeworks,
|
||||||
: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
|
||||||
|
|
||||||
|
@ -122,6 +124,29 @@ 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]
|
||||||
|
|
|
@ -5,4 +5,3 @@
|
||||||
<% else %> <!--for student-->
|
<% else %> <!--for student-->
|
||||||
<%= render :partial => 'my_joinedcourse' %>
|
<%= render :partial => 'my_joinedcourse' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue