rosa-build/app/controllers/repositories_controller.rb

42 lines
945 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
2011-03-31 02:15:17 +01:00
@projects = @repository.projects.recent
end
def new
@repository = @platform.repositories.new
end
def destroy
@repository.destroy
2011-03-31 03:00:21 +01:00
flash[:notice] = t("flash.repository.destroyed")
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