1、增加了参与竞赛的用户列表

2、区分了个人主页里“粉丝”列表里的项目与课程的计数与显示
3、竞赛发布人的名字改为了全称
This commit is contained in:
baiyu 2013-11-14 17:01:06 +08:00
parent 005e0802d4
commit 2f8ef03d32
7 changed files with 120 additions and 8 deletions

View File

@ -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)

View File

@ -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 = ''

View File

@ -0,0 +1,33 @@
<!--add by bai-->
<h3><%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count)%></h3>
<div class="inf_user_image">
<% for temp in @bid.join_in_contests %>
<% user = temp.user %>
<ul class="list_watch"><li>
<table width="660px" border="0" align="center">
<tr>
<td colspan="2" valign="top" width="50" ><%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :title => "#{user.name}" %></td>
<td><table width="580px" border="0">
<tr>
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description">
<% 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 %>
</p></td>
</tr>
<tr>
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>
</tr>
</table></td>
</tr>
</table></li></ul>
<% end %>
</div>

View File

@ -73,7 +73,7 @@
</table>
<table>
<tr>
<td><%= l(:lable_contest_user) %><%= link_to(@user, user_path(@user))%></td>
<td><%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%></td>
</tr>
<tr>
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
@ -147,7 +147,7 @@
</table>
</div>
</div>
<!--fans-->
<!-- participate -->
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_bidding_project) %></strong>
@ -178,6 +178,27 @@
</div>
<!-- end -->
<div class="user_underline"></div>
<!--fans fq-->
<div class="user_fans">
<div class="font_title_left">
<strong><%= l(:label_x_join_in_contest, :count => @bid.join_in_contests.count) %></strong>
<% if show_more_participate?(@bid) %>
<div style="font-size: 11px; display: inline; float: right; margin-top: 5px; margin-right: 20px" >
<%= link_to l(:label_more), :controller => "bids", :action => "show_participator"%>
</div>
<% end %>
</div>
<div class="left_wf">
<table>
<tr>
<td style="padding-top: 5px"> <%= show_participate_picture(@bid) %> </td>
</tr>
</table>
</div>
</div>
</div>
<div id="content">
<% if display_main_menu?(@bid) %>

View File

@ -11,16 +11,33 @@
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user), :class => "project_avatar_name" %>
</td>
</tr>
<tr>
<td colspan="2" width="580px" ><p class="font_description">
<tr>
<!-- added by bai 区分了个人列表里的项目与课程 -->
<td colspan="2" width="580px" ><p class="font_description">
<% 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 %>
</p></td>
</p>
<p class="font_description">
<% 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 %>
</p>
</td>
</tr>
<!-- end -->
<tr>
<td width="200" align="right" class="font_lighter"><%= l(:label_user_joinin) %><%= format_date(user.created_on) %>
</td>

View File

@ -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

View File

@ -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'