mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-05-30 00:11:31 +00:00
Purged git history and removed sensitive information.
This commit is contained in:
commit
8ed526716f
857 changed files with 25312 additions and 0 deletions
40
app/controllers/brackets_controller.rb
Normal file
40
app/controllers/brackets_controller.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
class BracketsController < ApplicationController
|
||||
before_filter :get_bracket, :only => [:show, :edit, :update, :destroy]
|
||||
|
||||
def edit
|
||||
raise AccessError unless @bracket.can_update? cuser
|
||||
end
|
||||
|
||||
def create
|
||||
@bracket = Bracket.new params[:bracket]
|
||||
raise AccessError unless @bracket.can_create? cuser
|
||||
|
||||
if @bracket.save
|
||||
flash[:notice] = t(:brackets_create)
|
||||
end
|
||||
|
||||
redirect_to edit_contest_path(@bracket.contest)
|
||||
end
|
||||
|
||||
def update
|
||||
raise AccessError unless @bracket.can_update? cuser
|
||||
|
||||
if @bracket.update_attributes params[:bracket] and @bracket.update_cells(params[:cell])
|
||||
flash[:notice] = t(:brackets_update)
|
||||
end
|
||||
|
||||
render :action => "edit"
|
||||
end
|
||||
|
||||
def destroy
|
||||
raise AccessError unless @bracket.can_destroy? cuser
|
||||
@bracket.destroy
|
||||
redirect_to edit_contest_path(@bracket.contest)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def get_bracket
|
||||
@bracket = Bracket.find(params[:id])
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue