diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-01-04 00:42:14 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2012-01-04 00:42:14 +0200 |
commit | 2dae0e18e09132c0db32c8646d8d11b30cfcb83f (patch) | |
tree | b28e2b90fae53324750e82e47898ab815c0bb82e /app/controllers/hooks_controller.rb | |
parent | 8d7aaf0e5501c472504467b9252dd5bde14a98c8 (diff) | |
download | gitlab-ce-2dae0e18e09132c0db32c8646d8d11b30cfcb83f.tar.gz |
web hooks scaffold started
Diffstat (limited to 'app/controllers/hooks_controller.rb')
-rw-r--r-- | app/controllers/hooks_controller.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/app/controllers/hooks_controller.rb b/app/controllers/hooks_controller.rb new file mode 100644 index 00000000000..70516dacf72 --- /dev/null +++ b/app/controllers/hooks_controller.rb @@ -0,0 +1,43 @@ +class HooksController < ApplicationController + before_filter :authenticate_user! + before_filter :project + layout "project" + + # Authorize + before_filter :add_project_abilities + before_filter :authorize_read_project! + before_filter :authorize_admin_project!, :only => [:new, :create, :destroy] + + respond_to :html + + def index + @hooks = @project.web_hooks + end + + def new + @hook = @project.web_hooks.new + end + + def create + @hook = @project.web_hooks.new(params[:hook]) + @hook.author = current_user + @hook.save + + if @hook.valid? + redirect_to [@project, @hook] + else + respond_with(@hook) + end + end + + def show + @hook = @project.web_hooks.find(params[:id]) + end + + def destroy + @hook = @project.web_hooks.find(params[:id]) + @hook.destroy + + redirect_to project_hooks_path(@project) + end +end |