gitlabhq/app/controllers/admin/hooks_controller.rb
Robert Speicher 925183ed7a Add an AdminController base class for Admin controllers
Handles stuff that's shared across admin controllers.
2012-09-16 10:06:29 -04:00

40 lines
762 B
Ruby

class Admin::HooksController < AdminController
def index
@hooks = SystemHook.all
@hook = SystemHook.new
end
def create
@hook = SystemHook.new(params[:hook])
if @hook.save
redirect_to admin_hooks_path, notice: 'Hook was successfully created.'
else
@hooks = SystemHook.all
render :index
end
end
def destroy
@hook = SystemHook.find(params[:id])
@hook.destroy
redirect_to admin_hooks_path
end
def test
@hook = SystemHook.find(params[:hook_id])
data = {
event_name: "project_create",
name: "Ruby",
path: "ruby",
project_id: 1,
owner_name: "Someone",
owner_email: "example@gitlabhq.com"
}
@hook.execute(data)
redirect_to :back
end
end