Merge branch 'develop' of 10.0.47.245:/home/trustie2 into develop

This commit is contained in:
yanxd 2013-11-20 10:46:59 +08:00
commit 8ec2d8342b
13 changed files with 133 additions and 16 deletions

View File

@ -8,7 +8,7 @@ class BidsController < ApplicationController
menu_item :homework_statistics, :only => :homework_statistics menu_item :homework_statistics, :only => :homework_statistics
#Ended by young #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, 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_participator] :show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
# added by fq # added by fq
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest] before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
# end # end
@ -248,11 +248,22 @@ class BidsController < ApplicationController
end end
# added by bai # added by bai 增加了参与者和竞赛设置
def show_participator def show_participator
render :layout => 'base_contest' render :layout => 'base_contest'
end end
def settings
if @bid.author.id == User.current.id
if @bid.reward_type == 2
@contest = Bid.find_by_reward_type(@bid.reward_type)
render :layout => 'base_contest'
end
else
render_403 :message => :notice_not_contest_setting_authorized
end
end
#end #end
def show_course def show_course
@ -597,6 +608,29 @@ class BidsController < ApplicationController
end end
end end
# added by bai
def update_contest
@bid = Bid.find(params[:id])
@bid.name = params[:bid][:name]
@bid.description = params[:bid][:description]
@bid.reward_type = 2
@bid.budget = params[:bid][:budget]
@bid.deadline = params[:bid][:deadline]
@bid.password = params[:bid][:password]
@bid.author_id = User.current.id
@bid.commit = 0
if @bid.save
unless @bid.watched_by?(User.current)
if @bid.add_watcher(User.current)
flash[:notice] = l(:label_bid_succeed)
end
end
redirect_to respond_path(@bid)
else
@bid.safe_attributes = params[:bid]
render :action => 'new_bid'
end
end
#huang #huang
def new_contest def new_contest
@bid = Bid.new @bid = Bid.new

View File

@ -0,0 +1,30 @@
<!-- added by bai -->
<h3><%=l(:label_settings)%></h3>
<script type="text/javascript" language="javascript">
function show(id, id_t, label_reward, label_money, label_credit, label_content) {
var text = $('#' + id);
var text_t = $('#' + id_t);
if (text.val() == 0) {
text_t.attr("placeholder", label_reward);
}
if (text.val() == 1) {
text_t.attr("placeholder", label_money);
}
if (text.val() == 3) {
text_t.attr("placeholder", label_credit);
}
if (text.val() == 2) {
text_t.attr("placeholder", label_content);
}
return content;
}
</script>
<%= error_messages_for 'bid' %>
<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'update_contest'} do |f| %>
<div class="box tabular">
<%= render :partial => 'form_contest', :locals => { :f => f } %>
</div>
<%= submit_tag l(:button_create) %>
<%= javascript_tag "$('#bid_name').focus();" %>
<% end %>

View File

@ -12,7 +12,7 @@
:title => "#{user.show_name}" %></td> :title => "#{user.show_name}" %></td>
<td><table width="580px" border="0"> <td><table width="580px" border="0">
<tr> <tr>
<td colspan="2" valign="top"><strong><%= content_tag "div", link_to_user(user.show_name), :class => "project_avatar_name" , <td colspan="2" valign="top"><strong><%= content_tag "div", link_to(user.show_name, user_path(user)), :class => "project_avatar_name" ,
:title => "#{user.show_name}" %> :title => "#{user.show_name}" %>
<!-- added by bai 增加了学员的学号 --> <!-- added by bai 增加了学员的学号 -->

View File

@ -68,7 +68,7 @@
<table> <table>
<tr> <tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td> <td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
</tr> </tr>
<tr> <tr>
<td align="center"> <%= watcher_link(@bid, User.current) %></td> <td align="center"> <%= watcher_link(@bid, User.current) %></td>
</tr> </tr>
@ -86,7 +86,7 @@
<% if @bid.reward_type.nil? or @bid.reward_type == 1%> <% if @bid.reward_type.nil? or @bid.reward_type == 1%>
<td><%= l(:label_bids_reward_method) %><span style="color: #ed8924; font-weight: bold"><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %><%= @bid.budget%></span></td> <td><%= l(:label_bids_reward_method) %><span style="color: #ed8924; font-weight: bold"><%= l(:label_call_bonus) %>&nbsp;<%= l(:label_RMB_sign) %><%= @bid.budget%></span></td>
<% elsif @bid.reward_type == 2%> <% elsif @bid.reward_type == 2%>
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td> <td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
<% else %> <% else %>
<td><%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %>&nbsp;<%= @bid.budget%>&nbsp;<%= l(:label_bids_credit_number) %></td> <td><%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %>&nbsp;<%= @bid.budget%>&nbsp;<%= l(:label_bids_credit_number) %></td>
<% end %> <% end %>

View File

@ -62,19 +62,29 @@
<table> <table>
<tr> <tr>
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td> <td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
</tr> </tr>
<tr> <tr>
<td align="center"> <td rowspan="2" width="250px">
<%= join_in_contest(@bid, User.current)%> <%= join_in_contest(@bid, User.current)%>
<%= watcher_link(@bid, User.current) %> <!-- <%= link_to("选为作业", fork_path(@bid)) %> --></td> <%= watcher_link(@bid, User.current) %> <!-- <%= link_to("选为作业", fork_path(@bid)) %> --></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
</table> </table>
<!-- added by bai 增加了竞赛的配置 -->
<table> <table>
<tr><td style="padding-left: 130px">
<%if User.current.logged? %>
<% if @bid.author.id == User.current.id %>
<%= link_to l(:label_contest_modify_settings), {:controller => 'bids', :action => 'settings', :id => @bid} %>
<% end %>
<% end %>
</td>
</tr>
<tr> <tr>
<td><%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%></td> <td><%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%></td>
</tr> </tr>
<!-- end -->
<tr> <tr>
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td> <td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
</tr> </tr>

View File

@ -55,8 +55,8 @@
<td> <td>
<table> <table>
<tr> <tr>
<td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h @user.lastname<<@user.firstname %> <!-- added by bai --></td> <td class="info_font" align="center" style=" word-wrap: break-word; word-break: break-all"><%= h @user.lastname<<@user.firstname %> <!-- added by bai -->
<%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%> <%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%></td>
</tr> </tr>
<tr> <tr>
<td align="center"> <% unless User.current == @user %> <td align="center"> <% unless User.current == @user %>

View File

@ -22,7 +22,7 @@
<%= labelled_form_for @news, :url => project_news_index_path(@project), <%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => { :id => 'news-form', :multipart => true } do |f| %> :html => { :id => 'news-form', :multipart => true } do |f| %>
<%= render :partial => 'news/form', :locals => { :f => f } %> <%= render :partial => 'news/form', :locals => { :f => f } %>
<%= submit_tag l(:button_create) %> <%= submit_tag l(:button_create), :class => 'button-submit', :name => nil %>
<%= preview_link preview_news_path(:project_id => @project), 'news-form' %> | <%= preview_link preview_news_path(:project_id => @project), 'news-form' %> |
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()' %> <%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()' %>
<% end if @project %> <% end if @project %>

View File

@ -6,8 +6,12 @@
<%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %> <%= content_tag "p", "#{format_date(member.created_on)}#{l(:label_member_since)}", :class => "float_right member_since" %>
<% end %> <% end %>
<%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %> <%= member.user.nil? ? '' : (image_tag(url_to_avatar(member.user), :class => 'avatar')) %>
<%= content_tag "div", link_to_user(member.principal), :class => "nomargin avatar_name" %> <%= content_tag "div", link_to(member.user.show_name, user_path(member.user)), :class => "nomargin avatar_name" %>
<!--teacher's code disapeared moified by huang-->
<% unless member.user.user_extensions.identity ==0 %>
<!-- added by bai 加学号 -->
<%= content_tag "p", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :class => "nomargin avatar_name" %>
<% end %>
<% if @project.project_type == 1 %> <% if @project.project_type == 1 %>
<div class ="clear avatar_name"> &nbsp; <div class ="clear avatar_name"> &nbsp;
<p> <p>

View File

@ -5,6 +5,6 @@
</div> </div>
<div class="member_content"> <div class="member_content">
<%= error_messages_for 'member' %> <%= error_messages_for 'member' %>
<%= render :partial => @render_file, :locals => {:members => @members} %> <%= render :partial => @render_file, :locals => {:members => @members} %>
</div> </div>

View File

@ -168,6 +168,7 @@ zh:
notice_file_not_found: 您访问的页面不存在或已被删除。 notice_file_not_found: 您访问的页面不存在或已被删除。
notice_locking_conflict: 数据已被另一位用户更新 notice_locking_conflict: 数据已被另一位用户更新
notice_not_authorized: 对不起,您无权访问此页面。 notice_not_authorized: 对不起,您无权访问此页面。
notice_not_contest_setting_authorized: 对不起,您无权配置此竞赛。
notice_not_authorized_archived_project: 要访问的项目已经归档。 notice_not_authorized_archived_project: 要访问的项目已经归档。
notice_email_sent: "邮件已发送至 %{value}" notice_email_sent: "邮件已发送至 %{value}"
notice_email_error: "发送邮件时发生错误 (%{value})" notice_email_error: "发送邮件时发生错误 (%{value})"
@ -1588,6 +1589,7 @@ zh:
label_join_contest: 加入竞赛 label_join_contest: 加入竞赛
label_exit_contest: 退出竞赛 label_exit_contest: 退出竞赛
label_contest_modify_settings: 配置竞赛 #added by bai
label_no_current_participate: 该竞赛暂无参与者 label_no_current_participate: 该竞赛暂无参与者
#end #end

View File

@ -474,6 +474,8 @@ RedmineApp::Application.routes.draw do
post 'calls/:id/join_in_contest', :to => 'bids#join_in_contest', :as => 'join_in_contest' 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' delete 'calls/:id/join_in_contest', :to => 'bids#unjoin_in_contest'
match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai match 'calls/:id/show_participator', :to => 'bids#show_participator' #bai
match 'calls/:id/update_contest', :to => 'bids#update_contest' #bai
match 'calls/:id/settings', :to => 'bids#settings' #bai
delete 'attachment/:id', :to => 'attachments#delete_homework' delete 'attachment/:id', :to => 'attachments#delete_homework'
match 'new_join', :to => 'projects#new_join', :as => 'try_join' match 'new_join', :to => 'projects#new_join', :as => 'try_join'

View File

@ -31,7 +31,18 @@ h4 {border-bottom: 1px dotted #bbb;}
padding-bottom: 20px; padding-bottom: 20px;
padding-left: 5px; padding-left: 5px;
} }
.new_submit{
padding-bottom: 5px;
width: 55px;
height: 25px;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 12px;
color: #fff;
padding: 0px;
background: #15bccf;
border: 1px solid #15bccf;
}
.content-text-list{ .content-text-list{
margin-bottom: 10px; margin-bottom: 10px;
border-bottom: 1px dashed rgb(204, 204, 204); border-bottom: 1px dashed rgb(204, 204, 204);
@ -100,7 +111,18 @@ h4 {border-bottom: 1px dotted #bbb;}
padding-top: 5px; padding-top: 5px;
} }
.button-submit{
padding-bottom: 5px;
width: 55px;
height: 25px;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 12px;
color: #fff;
padding: 0px;
background: #15bccf;
border: 1px solid #15bccf;
}
/*end*/ /*end*/
.top-content-home{ .top-content-home{

View File

@ -1906,6 +1906,19 @@ input[type="submit"] {
text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2), 0px 1px 0px rgb(255, 255, 255); text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.2), 0px 1px 0px rgb(255, 255, 255);
cursor: pointer; cursor: pointer;
} }
input[type="button-submit"] {
padding-bottom: 5px;
width: 55px;
height: 25px;
font-family: '微软雅黑',Arial,Helvetica,sans-serif;
font-size: 12px;
color: #fff;
padding: 0px;
background: #15bccf;
border: 1px solid #15bccf;
}
#button_width_auto { #button_width_auto {
padding-bottom: 5px; padding-bottom: 5px;
width: auto; width: auto;