diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 09:08:10 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-16 09:08:10 +0000 |
commit | 13867d66e92c2fd8962a126db4fbdc32891343c9 (patch) | |
tree | 580a1baf1cdd3283ede126ee510ecf1d3562a471 /app/helpers/hooks_helper.rb | |
parent | 83758a4e5fcfec056b36a4b56fb22c8a915753cc (diff) | |
download | gitlab-ce-13867d66e92c2fd8962a126db4fbdc32891343c9.tar.gz |
Add latest changes from gitlab-org/gitlab@masterogolowinski-master-patch-27476
Diffstat (limited to 'app/helpers/hooks_helper.rb')
-rw-r--r-- | app/helpers/hooks_helper.rb | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/app/helpers/hooks_helper.rb b/app/helpers/hooks_helper.rb index c4b39939192..9466a37ed93 100644 --- a/app/helpers/hooks_helper.rb +++ b/app/helpers/hooks_helper.rb @@ -2,18 +2,40 @@ module HooksHelper def link_to_test_hook(hook, trigger) - path = case hook - when ProjectHook - project = hook.project - test_project_hook_path(project, hook, trigger: trigger) - when SystemHook - test_admin_hook_path(hook, trigger: trigger) - end - + path = test_hook_path(hook, trigger) trigger_human_name = trigger.to_s.tr('_', ' ').camelize link_to path, rel: 'nofollow', method: :post do content_tag(:span, trigger_human_name) end end + + def test_hook_path(hook, trigger) + case hook + when ProjectHook + test_project_hook_path(hook.project, hook, trigger: trigger) + when SystemHook + test_admin_hook_path(hook, trigger: trigger) + end + end + + def edit_hook_path(hook) + case hook + when ProjectHook + edit_project_hook_path(hook.project, hook) + when SystemHook + edit_admin_hook_path(hook) + end + end + + def destroy_hook_path(hook) + case hook + when ProjectHook + project_hook_path(hook.project, hook) + when SystemHook + admin_hook_path(hook) + end + end end + +HooksHelper.prepend_if_ee('EE::HooksHelper') |