blob: feaa16b6875624823eec884a40e4d7fb192fac0a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
class HooksController < ProjectResourceController
# Authorize
before_filter :authorize_read_project!
before_filter :authorize_admin_project!, only: [:new, :create, :destroy]
respond_to :html
layout "project_settings"
def index
@hooks = @project.hooks.all
@hook = ProjectHook.new
end
def create
@hook = @project.hooks.new(params[:hook])
@hook.save
if @hook.valid?
redirect_to project_hooks_path(@project)
else
@hooks = @project.hooks.all
render :index
end
end
def test
TestHookContext.new(project, current_user, params).execute
redirect_to :back
end
def destroy
@hook = @project.hooks.find(params[:id])
@hook.destroy
redirect_to project_hooks_path(@project)
end
end
|