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
#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_participator]
:show_course, :show_bid_project, :show_bid_user, :join_in_contest, :unjoin_in_contest, :new_join,:show_participator, :settings]
# added by fq
before_filter :require_login, :only => [:join_in_contest, :unjoin_in_contest]
# end
@ -248,11 +248,22 @@ class BidsController < ApplicationController
end
# added by bai
# added by bai 增加了参与者和竞赛设置
def show_participator
render :layout => 'base_contest'
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
def show_course
@ -597,6 +608,29 @@ class BidsController < ApplicationController
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
def new_contest
@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>
<td><table width="580px" border="0">
<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}" %>
<!-- added by bai 增加了学员的学号 -->

View File

@ -64,17 +64,27 @@
<td class="info_font" style=" word-wrap: break-word; word-break: break-all"><%= h @bid.name %></td>
</tr>
<tr>
<td align="center">
<td rowspan="2" width="250px">
<%= 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>
</table></td>
</tr>
</table>
<!-- added by bai 增加了竞赛的配置 -->
<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>
<td><%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%></td>
</tr>
<!-- end -->
<tr>
<td><%= l(:label_bids_reward_method) %><%= @bid.budget%></td>
</tr>

View File

@ -55,8 +55,8 @@
<td>
<table>
<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>
<%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%>
<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) )%></td>
</tr>
<tr>
<td align="center"> <% unless User.current == @user %>

View File

@ -22,7 +22,7 @@
<%= labelled_form_for @news, :url => project_news_index_path(@project),
:html => { :id => 'news-form', :multipart => true } do |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' %> |
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-news").hide()' %>
<% 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" %>
<% end %>
<%= 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 %>
<div class ="clear avatar_name"> &nbsp;
<p>

View File

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

View File

@ -32,6 +32,17 @@ h4 {border-bottom: 1px dotted #bbb;}
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{
margin-bottom: 10px;
border-bottom: 1px dashed rgb(204, 204, 204);
@ -100,7 +111,18 @@ h4 {border-bottom: 1px dotted #bbb;}
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*/
.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);
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 {
padding-bottom: 5px;
width: auto;