diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-05 10:47:23 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-05 10:47:23 +0200 |
commit | c293cc91522544f5a45fc00b842fc23fa228cdf9 (patch) | |
tree | 2ed47ab1619d0e57905090b3408025fe66a16b2e /app/controllers | |
parent | 0de7c83a78711601b40b5a739070da2e3af29b11 (diff) | |
download | gitlab-ce-c293cc91522544f5a45fc00b842fc23fa228cdf9.tar.gz |
Move CI web hooks page to project settings area
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/ci/web_hooks_controller.rb | 53 | ||||
-rw-r--r-- | app/controllers/projects/ci_web_hooks_controller.rb | 45 |
2 files changed, 45 insertions, 53 deletions
diff --git a/app/controllers/ci/web_hooks_controller.rb b/app/controllers/ci/web_hooks_controller.rb deleted file mode 100644 index 24074a6d9ac..00000000000 --- a/app/controllers/ci/web_hooks_controller.rb +++ /dev/null @@ -1,53 +0,0 @@ -module Ci - class WebHooksController < Ci::ApplicationController - before_action :authenticate_user! - before_action :project - before_action :authorize_access_project! - before_action :authorize_manage_project! - - layout 'ci/project' - - def index - @web_hooks = @project.web_hooks - @web_hook = Ci::WebHook.new - end - - def create - @web_hook = @project.web_hooks.new(web_hook_params) - @web_hook.save - - if @web_hook.valid? - redirect_to ci_project_web_hooks_path(@project) - else - @web_hooks = @project.web_hooks.select(&:persisted?) - render :index - end - end - - def test - Ci::TestHookService.new.execute(hook, current_user) - - redirect_to :back - end - - def destroy - hook.destroy - - redirect_to ci_project_web_hooks_path(@project) - end - - private - - def hook - @web_hook ||= @project.web_hooks.find(params[:id]) - end - - def project - @project = Ci::Project.find(params[:project_id]) - end - - def web_hook_params - params.require(:web_hook).permit(:url) - end - end -end diff --git a/app/controllers/projects/ci_web_hooks_controller.rb b/app/controllers/projects/ci_web_hooks_controller.rb new file mode 100644 index 00000000000..7f40ddcb3f3 --- /dev/null +++ b/app/controllers/projects/ci_web_hooks_controller.rb @@ -0,0 +1,45 @@ +class Projects::CiWebHooksController < Projects::ApplicationController + before_action :ci_project + before_action :authorize_admin_project! + + layout "project_settings" + + def index + @web_hooks = @ci_project.web_hooks + @web_hook = Ci::WebHook.new + end + + def create + @web_hook = @ci_project.web_hooks.new(web_hook_params) + @web_hook.save + + if @web_hook.valid? + redirect_to namespace_project_ci_web_hooks_path(@project.namespace, @project) + else + @web_hooks = @ci_project.web_hooks.select(&:persisted?) + render :index + end + end + + def test + Ci::TestHookService.new.execute(hook, current_user) + + redirect_to :back + end + + def destroy + hook.destroy + + redirect_to namespace_project_ci_web_hooks_path(@project.namespace, @project) + end + + private + + def hook + @web_hook ||= @ci_project.web_hooks.find(params[:id]) + end + + def web_hook_params + params.require(:web_hook).permit(:url) + end +end |