修正了竞赛配置的问题

This commit is contained in:
baiyu 2013-11-19 16:05:52 +08:00
parent 6c9c849e7c
commit 9293ef53b9
3 changed files with 24 additions and 1 deletions

View File

@ -248,7 +248,7 @@ class BidsController < ApplicationController
end
# added by bai
# added by bai 增加了参与者和竞赛设置
def show_participator
render :layout => 'base_contest'
@ -608,6 +608,28 @@ class BidsController < ApplicationController
end
end
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

@ -474,6 +474,7 @@ 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'
delete 'attachment/:id', :to => 'attachments#delete_homework'