diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index 749d40a7..10b28271 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -3,7 +3,6 @@ class BidsController < ApplicationController before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add] helper :watchers - def index if params[:bid_title] Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description]) @@ -119,9 +118,9 @@ class BidsController < ApplicationController rescue ActiveRecord::RecordNotFound render_404 end - + def new_bid - + end def more diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 672c18d2..eedb307d 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -17,8 +17,8 @@ class UsersController < ApplicationController layout 'base_users' - before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments] - before_filter :find_user, :only => [:show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments] + before_filter :require_admin, :except => [:show, :index,:tag_save, :user_projects, :user_newfeedback, :user_comments, :watch_bids] + before_filter :find_user, :only => [:show, :edit, :update, :destroy, :edit_membership, :destroy_membership, :user_activities, :user_projects, :user_newfeedback, :user_comments, :watch_bids] accept_api_auth :index, :show, :create, :update, :destroy helper :sort @@ -62,6 +62,18 @@ class UsersController < ApplicationController end end + ##added by fq + def watch_bids + @bid = Bid.watched_by(@user) + + respond_to do |format| + format.html { + render :layout => 'base_users' + } + format.api + end + end + def user_activities #####fq diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index eef4ab73..264b5870 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -32,7 +32,7 @@ module WatchersHelper watched = objects.any? {|object| object.watched_by?(user)} css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') - text = (objects.first.instance_of?(User) or objects.first.instance_of?(Project)) ? + text = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or (objects.first.instance_of?(Bid))) ? (watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch)) url = watch_path( diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb index e5aa2a08..94d1de53 100644 --- a/app/views/layouts/base_bids.html.erb +++ b/app/views/layouts/base_bids.html.erb @@ -66,7 +66,7 @@
- <%= render :partial => 'layouts/tag', :locals => {:obj => @bid,:object_flag => "4"}%> + <%= render :partial => 'layouts/tag', :locals => {:obj => @bid, :object_flag => "4"}%>
diff --git a/app/views/users/watch_bids.html.erb b/app/views/users/watch_bids.html.erb new file mode 100644 index 00000000..5d2b70e1 --- /dev/null +++ b/app/views/users/watch_bids.html.erb @@ -0,0 +1,41 @@ + + +
需求列表
+ +<% for bid in @bid%> + + + + + + +
<%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'), :class => "avatar" %> + + + + + + + + + + + +
<%= link_to(bid.author, user_path(bid.author), :class => 'bid_user') %>:<%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %>
+ + + + + + + +
悬赏:¥<%= bid.budget%>(<%= bid.biding_projects.count%>)应标(<%= bid.commit %>)反馈(<%= bid.watcher_users.count%>)关注
<%= format_time bid.created_at %>
+
+ + + + +
<%= bid.description%>
+
+ +<% end %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index fd56217b..704998cb 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -73,7 +73,8 @@ RedmineApp::Application.routes.draw do member do match 'user_projects', :to => 'users#user_projects', :via => :get, :as => "user_projects" match 'user_activities', :to => 'users#show', :via => :get, :as => "user_activities" - match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" + match 'user_newfeedback', :to => 'users#user_newfeedback', :via => :get, :as => "user_newfeedback" + match 'watch_bids', :controller => 'users', :action => 'watch_bids', :via => [:get , :post] end end #end @@ -420,6 +421,7 @@ RedmineApp::Application.routes.draw do match 'bids/:bid_id/show', :controller => 'bids', :action => 'show', :as => 'respond' match 'bids/new', :controller => 'bids', :action => 'new', :via => [:get , :post] + ########### added by liuping match 'tags/add_tag',:to => 'tags#add_tag',:as=>"add_tag"