rosa-build/app/controllers/projects_controller.rb

39 lines
851 B
Ruby
Raw Normal View History

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
before_filter :find_repository
2011-03-10 14:20:09 +00:00
before_filter :find_project, :only => [:show]
2011-03-10 13:38:50 +00:00
def new
2011-03-11 16:30:02 +00:00
@project = @repository.projects.new
2011-03-10 13:38:50 +00:00
end
2011-03-10 14:20:09 +00:00
def show
end
2011-03-10 13:38:50 +00:00
def create
2011-03-11 16:30:02 +00:00
@project = @repository.projects.new params[:project]
2011-03-10 13:38:50 +00:00
if @project.save
flash[:notice] = t('flash.project.saved')
2011-03-11 16:30:02 +00:00
redirect_to [@platform, @repository]
2011-03-10 13:38:50 +00:00
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_repository
2011-03-11 16:30:02 +00:00
@repository = @platform.repositories.find(params[:repository_id])
end
2011-03-10 14:20:09 +00:00
def find_project
@project = @repository.projects.find params[:id]
2011-03-10 14:20:09 +00:00
end
2011-03-10 11:35:46 +00:00
end