Commit 9aeea3d4 authored by Justin Ho's avatar Justin Ho

Add controller and views for instance integrations

- And routes
- Controller only with simple edit
- Fix issue with passing of partial loca variable
to make way for future-improvements to rename to
"integrations" instead of using instance variables
parent 66edd108
# frozen_string_literal: true
class Admin::IntegrationsController < Admin::ApplicationController
include ServiceParams
before_action :set_integration, only: [:edit, :update, :test]
def edit
end
def update
if @service.update(service_params[:service])
redirect_to edit_admin_application_settings_integration_path(@service), notice: success_message
else
render :edit
end
end
def test
end
private
def set_integration
@service ||= Project.first.find_or_initialize_service(params[:id])
end
def success_message
if @service.active?
_('%{service_title} activated.') % { service_title: @service.title }
else
_('%{service_title} settings saved, but not activated.') % { service_title: @service.title }
end
end
end
%h3.page-title
= @service.title
%p= @service.description
= form_for :service, url: admin_application_settings_integration_path, method: :put, html: { class: 'fieldset-form' } do |form|
= render 'shared/service_settings', form: form, service: @service
.footer-block.row-content-block
= form.submit 'Save', class: 'btn btn-success'
- add_to_breadcrumbs _('Integrations'), admin_application_settings_integration_path
- breadcrumb_title @service.title
- page_title @service.title, _('Integrations')
= render 'form'
......@@ -4,7 +4,7 @@
%p #{@service.description} template.
= form_for :service, url: admin_application_settings_service_path, method: :put, html: { class: 'fieldset-form' } do |form|
= render 'shared/service_settings', form: form, subject: @service
= render 'shared/service_settings', form: form, service: @service
.footer-block.row-content-block
= form.submit 'Save', class: 'btn btn-success'
......@@ -11,7 +11,7 @@
%p= @service.detailed_description
.col-lg-9
= form_for(@service, as: :service, url: project_service_path(@project, @service.to_param), 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, subject: @service
= render 'shared/service_settings', form: form, service: @service
- if @service.editable?
.footer-block.row-content-block
= service_save_button(@service)
......
......@@ -121,6 +121,7 @@ namespace :admin do
get '/', to: redirect('admin/application_settings/general'), as: nil
resources :services, only: [:index, :edit, :update]
resources :integrations, only: [:edit, :update, :test]
get :usage_data
put :reset_registration_token
......
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