diff --git a/app/controllers/contests_controller.rb b/app/controllers/contests_controller.rb index 0c260cc..1b6731b 100644 --- a/app/controllers/contests_controller.rb +++ b/app/controllers/contests_controller.rb @@ -66,17 +66,17 @@ class ContestsController < ApplicationController def update raise AccessError unless @contest.can_update? cuser - if params[:commit] == "Save" + if update_type == "contest" if @contest.update_attributes(params[:contest]) flash[:notice] = t(:contests_update) redirect_to @contest else render :edit end - elsif params[:commit] == "Add map" + elsif update_type == "map" @contest.maps << Map.find(params[:map]) render :edit - elsif params[:commit] == "Add team" + elsif update_type == "team" contester = Contester.new contester.team = Team.find params[:team] contester.contest = @contest @@ -107,4 +107,8 @@ class ContestsController < ApplicationController def get_contest @contest = Contest.find params[:id] end + + def update_type + params[:type] + end end diff --git a/app/views/contests/edit.html.erb b/app/views/contests/edit.html.erb index a3af0fb..ea4e40c 100644 --- a/app/views/contests/edit.html.erb +++ b/app/views/contests/edit.html.erb @@ -16,6 +16,7 @@