diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index 6c5ff1680..a6fa6ed8c 100644
--- a/app/controllers/bids_controller.rb
+++ b/app/controllers/bids_controller.rb
@@ -8,7 +8,7 @@ class BidsController < ApplicationController
menu_item :homework_statistics, :only => :homework_statistics
#Ended by young
before_filter :find_bid, :only => [:show, :show_project, :create,:destroy,:more,:back,:add,:new,:show_results,:set_reward, :add_homework, :fork, :create_fork,
- :show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join]
+ :show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator]
# added by fq
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
# end
@@ -247,6 +247,13 @@ class BidsController < ApplicationController
end
+
+ # added by bai
+ def show_participator
+ render :layout => 'base_contest'
+
+ end
+ #end
def show_course
bids = Bid.where('parent_id = ?', @bid.id)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 8956a95cc..0d2b44b1b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1393,7 +1393,7 @@ module ApplicationHelper
html << (content_tag "span", l(:label_no_current_fans))
end
for user in obj.watcher_users
- html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.name}")
+ html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.show_name}")
count = count + 1
if count >= 12
break
@@ -1401,7 +1401,33 @@ module ApplicationHelper
end
html.html_safe
end
+
+ # added by bai
+ def show_more_participate?(obj)
+ if obj.join_in_contests.count > 12
+ return true
+ else
+ return false
+ end
+ end
+
+ def show_participate_picture(obj)
+ html = ''
+ count = 0
+ if obj.join_in_contests.count == 0
+ html << (content_tag "span", l(:label_no_current_participate))
+ end
+ for temp in obj.join_in_contests
+ html << (link_to image_tag(url_to_avatar(temp.user), :class => "avatar"), user_path(temp.user), :class => "avatar", :title => "#{temp.user.show_name}")
+ count = count + 1
+ if count >= 12
+ break
+ end
+ end
+ html.html_safe
+ end
#end
+
# add by huang
def show_watcher_list(user)
html = ''
diff --git a/app/views/bids/show_participator.html.erb b/app/views/bids/show_participator.html.erb
new file mode 100644
index 000000000..6ac248192
--- /dev/null
+++ b/app/views/bids/show_participator.html.erb
@@ -0,0 +1,33 @@
+
+
<%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count)%>
+
+ <% for temp in @bid.join_in_contests %>
+ <% user = temp.user %>
+
-
+
+
+ <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %> |
+
+
+ <%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
+ |
+
+
+
+ <% unless user.memberships.empty? %>
+ <%= l(:label_x_contribute_to, :count => user.memberships.count) %>
+ <% for member in user.memberships %>
+ <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
+ <% end %>
+ <% end %>
+ |
+
+
+ <%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
+ |
+
+ |
+
+
+<% end %>
+
\ No newline at end of file
diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb
index fde90107a..2af659def 100644
--- a/app/views/layouts/base_contest.html.erb
+++ b/app/views/layouts/base_contest.html.erb
@@ -73,7 +73,7 @@
- <%= l(:lable_contest_user) %><%= link_to(@user, user_path(@user))%> |
+ <%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%> |
<%= l(:label_bids_reward_method) %><%= @bid.budget%> |
@@ -147,7 +147,7 @@
-
+
<%= l(:label_bidding_project) %>
@@ -178,6 +178,27 @@
+
+
+
+
+
+
<%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %>
+ <% if show_more_participate?(@bid) %>
+
+ <%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%>
+
+ <% end %>
+
+
+
+
+ <%= show_participate_picture(@bid) %> |
+
+
+
+
+
<% if display_main_menu?(@bid) %>
diff --git a/app/views/users/user_fanslist.html.erb b/app/views/users/user_fanslist.html.erb
index 2c8c6b18e..5a9e5b314 100644
--- a/app/views/users/user_fanslist.html.erb
+++ b/app/views/users/user_fanslist.html.erb
@@ -11,16 +11,33 @@
<%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
|
-
-
+
+ |
+
+
<% unless user.memberships.empty? %>
- <%= l(:label_x_contribute_to, :count => user.memberships.count) %>
+ <% cond = Project.visible_condition(User.current) + "AND projects.project_type <> 1" %>
+ <% memberships = user.memberships.all(:conditions => cond) %>
+ <%= l(:label_x_contribute_to, :count => memberships.count) %>
<% for member in user.memberships %>
<%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
<% end %>
<% end %>
- |
+
+
+ <% unless user.memberships.empty? %>
+ <% cond = Project.visible_condition(User.current) + "AND projects.project_type = 1" %>
+ <% memberships = user.memberships.all(:conditions => cond) %>
+ <%= l(:label_x_course_contribute_to, :count => memberships.count) %>
+ <% for member in memberships %>
+ <%= link_to_project(member.project) %><%= (user.memberships.last == member) ? '' : ',' %>
+ <% end %>
+ <% end %>
+
+
+
+
<%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
|
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 263d15de4..18f3127bb 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -834,6 +834,11 @@ zh:
one: 粉丝
other: 粉丝
#end
+ label_x_join_in_contest:
+ zero: 参与者
+ one: 参与者
+ other: 参与者
+ #end
label_user_commits: "代码提交"
label_user_watchered: "关注" # huang添加的
label_user_newfeedback: "留言" ## huang添加的
@@ -1582,6 +1587,7 @@ zh:
label_join_contest: 加入竞赛
label_exit_contest: 退出竞赛
+ label_no_current_participate: 该竞赛暂无参与者
#end
diff --git a/config/routes.rb b/config/routes.rb
index 762cfdaec..7fe48d3d7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -473,6 +473,8 @@ RedmineApp::Application.routes.draw do
delete 'join_in/join', :to => 'courses#unjoin'
post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest'
delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest'
+ match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai
+
delete 'attachment/:id', :to => 'attachments#delete_homework'
match 'new_join', :to => 'projects#new_join', :as => 'try_join'
match 'new_join_in_contest', :to => 'bids#new_join', :as => 'try_join_in_contest'