From 9293ef53b9f81579ac157d179145c87b7ed3e375 Mon Sep 17 00:00:00 2001 From: baiyu Date: Tue, 19 Nov 2013 16:05:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E7=AB=9E=E8=B5=9B?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/bids_controller.rb | 24 ++++++++++++++++++- .../bids/{settings.erb => settings.html.erb} | 0 config/routes.rb | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) rename app/views/bids/{settings.erb => settings.html.erb} (100%) 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'