diff --git a/app/jobs/connect_app_job.rb b/app/jobs/connect_app_job.rb index 43d273f155..2474343a29 100644 --- a/app/jobs/connect_app_job.rb +++ b/app/jobs/connect_app_job.rb @@ -17,7 +17,7 @@ class ConnectAppJob < ApplicationJob return unless channel - selector = "#edit_enterprise_#{enterprise.id} #connected-app-discover-regen" + selector = "#connected-app-discover-regen.enterprise_#{enterprise.id}" html = ApplicationController.render( partial: "admin/enterprises/form/connected_apps", locals: { enterprise: }, diff --git a/app/views/admin/enterprises/_form.html.haml b/app/views/admin/enterprises/_form.html.haml index dcaae1a149..71a9b2378b 100644 --- a/app/views/admin/enterprises/_form.html.haml +++ b/app/views/admin/enterprises/_form.html.haml @@ -9,6 +9,11 @@ %fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }} %legend= t(".#{ item[:name] }.legend") + - when 'connected_apps' + -# Don't render this item here in the main form. + -# The panel contains its own form and we can't nest forms in forms. + -# Otherwise we add multiple authenticity tokens and Rails denies updates. + - else %fieldset.alpha.no-border-bottom{ id: "#{item[:name]}_panel", data: { "tabs-and-panels-target": "panel" }} %legend= t(".#{ item[:form_name] || item[:name] }.legend") diff --git a/app/views/admin/enterprises/_ng_form.html.haml b/app/views/admin/enterprises/_ng_form.html.haml index 3ea83f8fbd..5fd3d9b541 100644 --- a/app/views/admin/enterprises/_ng_form.html.haml +++ b/app/views/admin/enterprises/_ng_form.html.haml @@ -11,11 +11,4 @@ %input.red{ type: "button", value: t(:update), "ng-click": "submit()", "ng-disabled": "!enterprise_form.$dirty" } %input{ type: "button", "ng-value": "enterprise_form.$dirty ? '#{t(:cancel)}' : '#{t(:close)}'", "ng-click": "cancel('#{main_app.admin_enterprises_path}')" } - .row{ data: { - controller: "tabs-and-panels", "tabs-and-panels-class-name-value": "selected" }} - .sixteen.columns.alpha - .four.columns.alpha - = render 'admin/shared/side_menu' - .one.column   - .eleven.columns.omega.fullwidth_inputs - = render 'form', f: f + = render 'form', f: f diff --git a/app/views/admin/enterprises/edit.html.haml b/app/views/admin/enterprises/edit.html.haml index 0e6a9162b8..90fd8201c9 100644 --- a/app/views/admin/enterprises/edit.html.haml +++ b/app/views/admin/enterprises/edit.html.haml @@ -13,4 +13,14 @@ = render 'admin/enterprises/form_data' -= render 'admin/enterprises/ng_form', action: 'edit' +.row{ data: { controller: "tabs-and-panels", "tabs-and-panels-class-name-value": "selected" }} + .sixteen.columns.alpha + .four.columns.alpha + = render 'admin/shared/side_menu' + .one.column   + .eleven.columns.omega.fullwidth_inputs + = render 'admin/enterprises/ng_form', action: 'edit' + + %fieldset.alpha.no-border-bottom{ id: "connected_apps_panel", data: { "tabs-and-panels-target": "panel" }} + %legend= t("admin.enterprises.form.connected_apps.legend") + = render "admin/enterprises/form/connected_apps", enterprise: @enterprise diff --git a/app/views/admin/enterprises/form/_connected_apps.html.haml b/app/views/admin/enterprises/form/_connected_apps.html.haml index f2870da01f..2ffbceee81 100644 --- a/app/views/admin/enterprises/form/_connected_apps.html.haml +++ b/app/views/admin/enterprises/form/_connected_apps.html.haml @@ -1,5 +1,4 @@ -- enterprise ||= f.object -#connected-app-discover-regen +%div{ id: "connected-app-discover-regen", class: "enterprise_#{enterprise.id}" } .connected-app__head %div %h3= t ".title"