diff --git a/app/controllers/bids_controller.rb b/app/controllers/bids_controller.rb index e354e477..73eb3106 100644 --- a/app/controllers/bids_controller.rb +++ b/app/controllers/bids_controller.rb @@ -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 diff --git a/app/views/bids/settings.erb b/app/views/bids/settings.html.erb similarity index 100% rename from app/views/bids/settings.erb rename to app/views/bids/settings.html.erb diff --git a/config/routes.rb b/config/routes.rb index 14fa0c9d..2e897b4e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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'