2011-03-10 11:35:46 +00:00
|
|
|
class ProjectsController < ApplicationController
|
2011-03-10 13:38:50 +00:00
|
|
|
before_filter :authenticate_user!
|
|
|
|
before_filter :find_platform
|
2011-03-10 14:20:09 +00:00
|
|
|
before_filter :find_project, :only => [:show]
|
2011-03-10 13:38:50 +00:00
|
|
|
|
|
|
|
def new
|
|
|
|
@project = @platform.projects.new
|
|
|
|
end
|
|
|
|
|
2011-03-10 14:20:09 +00:00
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
2011-03-10 13:38:50 +00:00
|
|
|
def create
|
|
|
|
@project = @platform.projects.new params[:project]
|
|
|
|
if @project.save
|
|
|
|
flash[:notice] = t('flash.project.saved')
|
|
|
|
redirect_to @platform
|
|
|
|
else
|
|
|
|
flash[:error] = t('flash.project.save_error')
|
|
|
|
render :action => :new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def find_platform
|
|
|
|
@platform = Platform.find params[:platform_id]
|
|
|
|
end
|
2011-03-10 14:20:09 +00:00
|
|
|
|
|
|
|
def find_project
|
|
|
|
@project = @platform.projects.find params[:id]
|
|
|
|
end
|
2011-03-10 11:35:46 +00:00
|
|
|
end
|