From 2967023a0e4d27d5cbea7858b6f5f8b1af38f875 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Thu, 1 Dec 2011 21:14:09 +0000 Subject: Resourcified boards. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8020 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/boards_controller.rb | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'app/controllers') diff --git a/app/controllers/boards_controller.rb b/app/controllers/boards_controller.rb index 36b0e233c..f9a507e6b 100644 --- a/app/controllers/boards_controller.rb +++ b/app/controllers/boards_controller.rb @@ -62,23 +62,34 @@ class BoardsController < ApplicationController end end - verify :method => :post, :only => [ :destroy ], :redirect_to => { :action => :index } - def new - @board = Board.new(params[:board]) - @board.project = @project - if request.post? && @board.save + @board = @project.boards.build(params[:board]) + end + + verify :method => :post, :only => :create, :redirect_to => { :action => :index } + def create + @board = @project.boards.build(params[:board]) + if @board.save flash[:notice] = l(:notice_successful_create) redirect_to_settings_in_projects + else + render :action => 'new' end end def edit - if request.post? && @board.update_attributes(params[:board]) + end + + verify :method => :put, :only => :update, :redirect_to => { :action => :index } + def update + if @board.update_attributes(params[:board]) redirect_to_settings_in_projects + else + render :action => 'edit' end end + verify :method => :delete, :only => :destroy, :redirect_to => { :action => :index } def destroy @board.destroy redirect_to_settings_in_projects -- cgit v1.2.3