summaryrefslogtreecommitdiff
path: root/app/helpers/hooks_helper.rb
diff options
context:
space:
mode:
authorAlexander Randa <randa.alex@gmail.com>2017-07-20 15:12:06 +0000
committerRémy Coutable <remy@rymai.me>2017-07-20 15:12:06 +0000
commite0ab5618a0998175df9f90c95ebd35d7afa01db7 (patch)
tree91cfff5c3c9f6a118d69df5e2816b7461ce2ccc5 /app/helpers/hooks_helper.rb
parent020b6a0be06614815d96854084f3dcafeefcf0b7 (diff)
downloadgitlab-ce-e0ab5618a0998175df9f90c95ebd35d7afa01db7.tar.gz
Wrong data type when testing webhooks
Diffstat (limited to 'app/helpers/hooks_helper.rb')
-rw-r--r--app/helpers/hooks_helper.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/helpers/hooks_helper.rb b/app/helpers/hooks_helper.rb
new file mode 100644
index 00000000000..551b9cca6b1
--- /dev/null
+++ b/app/helpers/hooks_helper.rb
@@ -0,0 +1,17 @@
+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
+
+ trigger_human_name = trigger.to_s.tr('_', ' ').camelize
+
+ link_to path, rel: 'nofollow' do
+ content_tag(:span, trigger_human_name)
+ end
+ end
+end