diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb
index a6fa6ed8c..7d7861c16 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_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
diff --git a/app/views/bids/settings.html.erb b/app/views/bids/settings.html.erb
new file mode 100644
index 000000000..b9be79d43
--- /dev/null
+++ b/app/views/bids/settings.html.erb
@@ -0,0 +1,30 @@
+
+
<%=l(:label_settings)%>
+
+<%= error_messages_for 'bid' %>
+
+<%= labelled_form_for @bid, :url => {:controller => 'bids', :action => 'update_contest'} do |f| %>
+
+ <%= render :partial => 'form_contest', :locals => { :f => f } %>
+
+ <%= submit_tag l(:button_create) %>
+ <%= javascript_tag "$('#bid_name').focus();" %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/bids/show_participator.html.erb b/app/views/bids/show_participator.html.erb
index 80492de32..da62436b9 100644
--- a/app/views/bids/show_participator.html.erb
+++ b/app/views/bids/show_participator.html.erb
@@ -12,7 +12,7 @@
:title => "#{user.show_name}" %>
- <%= content_tag "div", link_to_user(user.show_name), :class => "project_avatar_name" ,
+ <%= content_tag "div", link_to(user.show_name, user_path(user)), :class => "project_avatar_name" ,
:title => "#{user.show_name}" %>
diff --git a/app/views/layouts/base_bids.html.erb b/app/views/layouts/base_bids.html.erb
index 377f44132..91584d42c 100644
--- a/app/views/layouts/base_bids.html.erb
+++ b/app/views/layouts/base_bids.html.erb
@@ -68,7 +68,7 @@
<%= h @bid.name %> |
-
+
<%= watcher_link(@bid, User.current) %> |
@@ -86,7 +86,7 @@
<% if @bid.reward_type.nil? or @bid.reward_type == 1%>
<%= l(:label_bids_reward_method) %><%= l(:label_call_bonus) %> <%= l(:label_RMB_sign) %><%= @bid.budget%> |
<% elsif @bid.reward_type == 2%>
- <%= l(:label_bids_reward_method) %><%= @bid.budget%> |
+ <%= l(:label_bids_reward_method) %><%= @bid.budget%> |
<% else %>
<%= l(:label_bids_reward_method) %><%= l(:label_bids_credit) %> <%= @bid.budget%> <%= l(:label_bids_credit_number) %> |
<% end %>
diff --git a/app/views/layouts/base_contest.html.erb b/app/views/layouts/base_contest.html.erb
index 2af659def..a75374eb8 100644
--- a/app/views/layouts/base_contest.html.erb
+++ b/app/views/layouts/base_contest.html.erb
@@ -62,19 +62,29 @@
<%= h @bid.name %> |
-
+
-
+ |
<%= join_in_contest(@bid, User.current)%>
- <%= watcher_link(@bid, User.current) %> |
+ <%= watcher_link(@bid, User.current) %>
+
+
+ <%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 %>
+ |
+
<%= l(:lable_contest_user) %><%= link_to(@user.show_name, user_path(@user))%> |
+
<%= l(:label_bids_reward_method) %><%= @bid.budget%> |
diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb
index 64c33e32a..5d66992c8 100644
--- a/app/views/layouts/base_users.html.erb
+++ b/app/views/layouts/base_users.html.erb
@@ -55,8 +55,8 @@
- <%= h @user.lastname<<@user.firstname %> |
- <%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%>
+ <%= h @user.lastname<<@user.firstname %>
+ <%= image_tag(gender_avatar_uri(@user), weight:"25px", height:"25px") if (@user.user_extensions && (@user.user_extensions.identity != 2) )%> |
<% unless User.current == @user %>
diff --git a/app/views/news/index.html.erb b/app/views/news/index.html.erb
index b4c23fd73..39fcfd7da 100644
--- a/app/views/news/index.html.erb
+++ b/app/views/news/index.html.erb
@@ -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 %>
diff --git a/app/views/projects/_member_list.html.erb b/app/views/projects/_member_list.html.erb
index 9040b6a51..e29dde733 100644
--- a/app/views/projects/_member_list.html.erb
+++ b/app/views/projects/_member_list.html.erb
@@ -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" %>
+
+ <% unless member.user.user_extensions.identity ==0 %>
+
+ <%= content_tag "p", "#{l(:label_bidding_user_studentcode)}#{' : '}#{member.user.user_extensions.student_id}", :class => "nomargin avatar_name" %>
+ <% end %>
<% if @project.project_type == 1 %>
diff --git a/app/views/projects/member.html.erb b/app/views/projects/member.html.erb
index 33eac5da1..3d3076bcc 100644
--- a/app/views/projects/member.html.erb
+++ b/app/views/projects/member.html.erb
@@ -5,6 +5,6 @@
<%= error_messages_for 'member' %>
- <%= render :partial => @render_file, :locals => {:members => @members} %>
+ <%= render :partial => @render_file, :locals => {:members => @members} %>
diff --git a/config/locales/zh.yml b/config/locales/zh.yml
index 2262c5e0c..0140d667f 100644
--- a/config/locales/zh.yml
+++ b/config/locales/zh.yml
@@ -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
diff --git a/config/routes.rb b/config/routes.rb
index 7fe48d3d7..dd1af90c7 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -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'
diff --git a/public/stylesheets/application.css b/public/stylesheets/application.css
index d6709d448..6be28f47b 100644
--- a/public/stylesheets/application.css
+++ b/public/stylesheets/application.css
@@ -31,7 +31,18 @@ h4 {border-bottom: 1px dotted #bbb;}
padding-bottom: 20px;
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{
diff --git a/public/themes/redpenny-master/stylesheets/application.css b/public/themes/redpenny-master/stylesheets/application.css
index 921d4ce2d..2fbc30426 100644
--- a/public/themes/redpenny-master/stylesheets/application.css
+++ b/public/themes/redpenny-master/stylesheets/application.css
@@ -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;
| | | | |