Module: HooksHelper
- Defined in:
- app/helpers/hooks_helper.rb
Instance Method Summary collapse
- #destroy_hook_path(hook) ⇒ Object
- #edit_hook_path(hook) ⇒ Object
- #hook_log_path(hook, hook_log) ⇒ Object
- #test_hook_path(hook, trigger) ⇒ Object
- #webhook_form_data(hook) ⇒ Object
- #webhook_test_items(hook, triggers) ⇒ Object
Instance Method Details
#destroy_hook_path(hook) ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/helpers/hooks_helper.rb', line 38 def destroy_hook_path(hook) case hook when ProjectHook project_hook_path(hook.project, hook) when SystemHook admin_hook_path(hook) end end |
#edit_hook_path(hook) ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/helpers/hooks_helper.rb', line 29 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 |
#hook_log_path(hook, hook_log) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'app/helpers/hooks_helper.rb', line 47 def hook_log_path(hook, hook_log) case hook when ProjectHook, ServiceHook hook_log.present.details_path when SystemHook admin_hook_hook_log_path(hook, hook_log) end end |
#test_hook_path(hook, trigger) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'app/helpers/hooks_helper.rb', line 20 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 |
#webhook_form_data(hook) ⇒ Object
4 5 6 7 8 9 |
# File 'app/helpers/hooks_helper.rb', line 4 def webhook_form_data(hook) { url: hook.url, url_variables: Gitlab::Json.dump(hook.url_variables.keys.map { { key: _1 } }) } end |
#webhook_test_items(hook, triggers) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/helpers/hooks_helper.rb', line 11 def webhook_test_items(hook, triggers) triggers.map do |trigger| { href: test_hook_path(hook, trigger), text: integration_webhook_event_human_name(trigger) } end end |