2018-12-05 23:21:45 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
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
|
|
|
|
|
2018-10-15 14:42:47 +05:30
|
|
|
link_to path, rel: 'nofollow', method: :post do
|
2017-09-10 17:25:29 +05:30
|
|
|
content_tag(:span, trigger_human_name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|