添加了用户主页中的关注需求界面,url为users/:id/watch_bids

This commit is contained in:
fanqiang 2013-08-02 08:53:07 +08:00
parent ee0d8ecb95
commit a97935a8ac
6 changed files with 62 additions and 8 deletions

View File

@ -3,7 +3,6 @@ class BidsController < ApplicationController
before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add] before_filter :find_bid, :only => [:show, :show_project, :create, :destroy, :more, :back, :add]
helper :watchers helper :watchers
def index def index
if params[:bid_title] if params[:bid_title]
Bid.creat_bids(params[:bid_budget], params[:bid_deadline], params[:bid_title] , params[:bid_description]) 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 rescue ActiveRecord::RecordNotFound
render_404 render_404
end end
def new_bid def new_bid
end end
def more def more

View File

@ -17,8 +17,8 @@
class UsersController < ApplicationController class UsersController < ApplicationController
layout 'base_users' layout 'base_users'
before_filter :require_admin, :except => [:show, :index,:tag_save, :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] 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 accept_api_auth :index, :show, :create, :update, :destroy
helper :sort helper :sort
@ -62,6 +62,18 @@ class UsersController < ApplicationController
end end
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 def user_activities
#####fq #####fq

View File

@ -32,7 +32,7 @@ module WatchersHelper
watched = objects.any? {|object| object.watched_by?(user)} watched = objects.any? {|object| object.watched_by?(user)}
css = [watcher_css(objects), watched ? 'icon icon-fav' : 'icon icon-fav-off'].join(' ') 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)) (watched ? l(:button_unfollow) : l(:button_follow)) : (watched ? l(:button_unwatch) : l(:button_watch))
url = watch_path( url = watch_path(

View File

@ -66,7 +66,7 @@
<table style="font-family:微软雅黑"> <table style="font-family:微软雅黑">
<tr> <tr>
<td><!-- added by william -for tag --> <td><!-- added by william -for tag -->
<%= render :partial => 'layouts/tag', :locals => {:obj => @bid,:object_flag => "4"}%> <%= render :partial => 'layouts/tag', :locals => {:obj => @bid, :object_flag => "4"}%>
</td> </td>
</tr> </tr>
</table> </table>

View File

@ -0,0 +1,41 @@
<table width="200px" border="0" style="padding-left: 10px; margin-bottom: 15px;">
<td class="font_lighter" style="font-size: 18px;">需求列表</td>
</table>
<% for bid in @bid%>
<table width="90%" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(bid.author), :class => 'avatar'), :class => "avatar" %></td>
<td>
<table width="100%" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= link_to(bid.author, user_path(bid.author), :class => 'bid_user') %>:<%= link_to(bid.name, respond_path(bid), :class => 'bid_path') %></strong></td>
</tr>
<tr>
<td width="500">
<table border="0">
<tr>
<td style="color: rgb(255, 0, 0);"><strong>悬赏:¥<%= bid.budget%></strong></td>
<td class="font_lighter">(<%= bid.biding_projects.count%>)应标</td>
<td class="font_lighter">(<%= bid.commit %>)反馈</td>
<td class="font_lighter">(<%= bid.watcher_users.count%>)关注</td>
</tr>
</table></td>
<td width="200" align="right" class="a"><a class="font_lighter"> <%= format_time bid.created_at %></a></td>
</tr>
<tr>
<td>
<div class="bid-description" style="border-left: 1px solid rgb(225, 225, 225); border-bottom: 1px solid rgb(225, 225, 225); padding-left: 20px; padding-bottom: 10px; margin-bottom: 20px;">
<table>
<tr>
<td> <%= bid.description%> </td>
</tr>
</table>
</div></td>
</tr>
</table></td>
</tr>
</table>
<% end %>

View File

@ -73,7 +73,8 @@ RedmineApp::Application.routes.draw do
member do member do
match 'user_projects', :to => 'users#user_projects', :via => :get, :as => "user_projects" 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_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 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/:bid_id/show', :controller => 'bids', :action => 'show', :as => 'respond'
match 'bids/new', :controller => 'bids', :action => 'new', :via => [:get , :post] match 'bids/new', :controller => 'bids', :action => 'new', :via => [:get , :post]
########### added by liuping ########### added by liuping
match 'tags/add_tag',:to => 'tags#add_tag',:as=>"add_tag" match 'tags/add_tag',:to => 'tags#add_tag',:as=>"add_tag"