Commit aff5f1f2 authored by Justin Ho's avatar Justin Ho

Refactor to re-use existing methods

Instead of introducing new ones
parent abaf1ec4
# frozen_string_literal: true
module ServicesHelper
def service_form_url(service, project: nil)
if project.present?
project_service_path(project, service.to_param)
else
admin_application_settings_integration_path(service.to_param)
end
end
def service_event_description(event)
case event
when "push", "push_events"
......@@ -82,7 +74,7 @@ module ServicesHelper
def scoped_integration_path(integration)
if @project.present?
project_settings_integration_path(@project, integration)
project_service_path(@project, integration)
elsif @group.present?
group_settings_integration_path(@group, integration)
else
......
......@@ -10,7 +10,7 @@
- if @service.respond_to?(:detailed_description)
%p= @service.detailed_description
.col-lg-9
= form_for(@service, as: :service, url: service_form_url(@service, project: @project), method: :put, html: { class: 'gl-show-field-errors integration-settings-form js-integration-settings-form', data: { 'can-test' => @service.can_test?, 'test-url' => test_project_service_path(@project, @service) } }) do |form|
= form_for(@service, as: :service, url: scoped_integration_path(@service), method: :put, html: { class: 'gl-show-field-errors integration-settings-form js-integration-settings-form', data: { 'can-test' => @service.can_test?, 'test-url' => test_project_service_path(@project, @service) } }) do |form|
= render 'shared/service_settings', form: form, service: @service
- if @service.editable?
.footer-block.row-content-block
......
.js-alerts-service-settings{ data: { activated: @service.activated?.to_s,
form_path: service_form_url(@service, project: @project),
form_path: scoped_integration_path(@service),
authorization_key: @service.token, url: @service.url, learn_more_url: 'https://docs.gitlab.com/ee/user/project/integrations/generic_alerts.html' } }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment