2015-03-27 09:43:48 -04:00
|
|
|
class Admin::DeployKeysController < Admin::ApplicationController
|
2015-04-16 08:03:37 -04:00
|
|
|
before_action :deploy_keys, only: [:index]
|
2015-06-03 17:27:23 -04:00
|
|
|
before_action :deploy_key, only: [:destroy]
|
2015-03-27 09:43:48 -04:00
|
|
|
|
|
|
|
def index
|
|
|
|
end
|
|
|
|
|
|
|
|
def new
|
2015-04-03 06:22:44 -04:00
|
|
|
@deploy_key = deploy_keys.new
|
2015-03-27 09:43:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def create
|
2015-04-03 06:22:44 -04:00
|
|
|
@deploy_key = deploy_keys.new(deploy_key_params)
|
2015-03-27 09:43:48 -04:00
|
|
|
|
|
|
|
if @deploy_key.save
|
|
|
|
redirect_to admin_deploy_keys_path
|
|
|
|
else
|
|
|
|
render "new"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def destroy
|
|
|
|
deploy_key.destroy
|
|
|
|
|
|
|
|
respond_to do |format|
|
|
|
|
format.html { redirect_to admin_deploy_keys_path }
|
|
|
|
format.json { head :ok }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
protected
|
|
|
|
|
|
|
|
def deploy_key
|
2015-04-03 06:22:44 -04:00
|
|
|
@deploy_key ||= deploy_keys.find(params[:id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def deploy_keys
|
|
|
|
@deploy_keys ||= DeployKey.are_public
|
2015-03-27 09:43:48 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def deploy_key_params
|
|
|
|
params.require(:deploy_key).permit(:key, :title)
|
|
|
|
end
|
|
|
|
end
|