rosa-build/app/controllers/repositories_controller.rb

41 lines
885 B
Ruby
Raw Normal View History

2011-03-11 16:15:06 +00:00
class RepositoriesController < ApplicationController
before_filter :authenticate_user!
before_filter :find_platform
before_filter :find_repository, :only => [:show, :destroy]
def show
@projects = @repository.projects
end
def new
@repository = @platform.repositories.new
end
def destroy
@repository.destroy
redirect_to platform_path(@platform)
end
def create
2011-03-11 16:30:02 +00:00
@repository = @platform.repositories.new(params[:repository])
if @repository.save
2011-03-31 01:59:12 +01:00
flash[:notice] = t('flash.repository.saved')
redirect_to [@platform, @repository]
else
2011-03-31 01:59:12 +01:00
flash[:error] = t('flash.repository.save_error')
render :action => :new
end
end
protected
def find_platform
@platform = Platform.find params[:platform_id]
end
def find_repository
@repository = @platform.repositories.find(params[:id])
end
end