- content_for :page_specific_javascripts do
  = webpack_bundle_tag('integrations')

.row.prepend-top-default.append-bottom-default
  .col-lg-3
    %h4.prepend-top-0
      = @service.title
      = boolean_to_icon @service.activated?

    %p= @service.description
  .col-lg-9
    = form_for(@service, as: :service, url: namespace_project_service_path(@project.namespace, @project, @service.to_param), method: :put, html: { class: 'gl-show-field-errors form-horizontal js-integration-settings-from' }) do |form|
      = render 'shared/service_settings', form: form, subject: @service
      .footer-block.row-content-block
        %button.btn.btn-save{ type: 'submit' }
          %i.fa.fa-spinner.fa-spin.hidden.js-btn-spinner{ "aria-hidden" => true }
          %span.js-btn-label
            Save changes
        &nbsp;
        - if @service.valid? && @service.activated?
          - unless @service.can_test?
            - disabled_class = 'disabled'
            - disabled_title = @service.disabled_title

        = link_to "Cancel", namespace_project_settings_integrations_path(@project.namespace, @project), class: "btn btn-cancel"

- content_for :page_specific_javascripts do
  = webpack_bundle_tag('integrations')

.row.prepend-top-default.append-bottom-default
  .col-lg-3
    %h4.prepend-top-0
      = @service.title
      = boolean_to_icon @service.activated?

    %p= @service.description
  .col-lg-9
    = form_for(@service, as: :service, url: namespace_project_service_path(@project.namespace, @project, @service.to_param), method: :put, html: { class: 'gl-show-field-errors form-horizontal js-integration-settings-from', data: { "can-test" => "#{@service.can_test?}" } }) do |form|
      = render 'shared/service_settings', form: form, subject: @service
      .footer-block.row-content-block
        %button.btn.btn-save{ type: 'submit' }
          %i.fa.fa-spinner.fa-spin.hidden.js-btn-spinner{ "aria-hidden" => true }
          %span.js-btn-label
            Save changes
        &nbsp;
        - if @service.valid? && @service.activated?
          - unless @service.can_test?
            - disabled_class = 'disabled'
            - disabled_title = @service.disabled_title

        = link_to "Cancel", namespace_project_settings_integrations_path(@project.namespace, @project), class: "btn btn-cancel"

Use `@service.can_test?` to enable test before save
Use `@service.can_test?` to enable test before save
