summaryrefslogtreecommitdiff
path: root/app/helpers/hooks_helper.rb
blob: 0a356ba55d2f29687d669a10bd4af427bda87ad5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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', method: :post do
      content_tag(:span, trigger_human_name)
    end
  end
end