blob: 314d87df034eec1bbb19e9b6d44e2a7e288215d0 (
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
|
class Projects::HooksController < Projects::ApplicationController
# Authorize
before_filter :authorize_admin_project!
respond_to :html
layout "project_settings"
def index
@hooks = @project.hooks
@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
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
|