diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index d49d5e245..795aaa872 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/users/watch_bids.html.erb b/app/views/users/watch_bids.html.erb index 856446291..3832fb54e 100644 --- a/app/views/users/watch_bids.html.erb +++ b/app/views/users/watch_bids.html.erb @@ -2,9 +2,7 @@ <% if @bid.size > 0%> - <% for bid in @bid %> - @@ -54,7 +52,6 @@
<%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'),user_path(bid.author), :class => "avatar" %>
- <% end %> <% else %>

<%= l(:label_follow_no_requirement) %>

-<% end %> +<% end %> \ No newline at end of file