diff --git a/app/assets/javascripts/application.js.coffee.erb b/app/assets/javascripts/application.js.coffee.erb index 8e59e128..c1530fc6 100644 --- a/app/assets/javascripts/application.js.coffee.erb +++ b/app/assets/javascripts/application.js.coffee.erb @@ -164,7 +164,7 @@ $(document).ready -> $(".description").html(json.description_html) if json.description_html? - $('.oauthable-form').html($(json.form).find('.oauthable-form').html()) if json.form? + $('.oauthable-form').html(json.form) if json.form? if $("#agent_options").hasClass("showing-default") || $("#agent_options").val().match(/\A\s*(\{\s*\}|)\s*\Z/g) window.jsonEditor.json = json.options diff --git a/app/controllers/agents_controller.rb b/app/controllers/agents_controller.rb index e276cb1a..7a2f551f 100644 --- a/app/controllers/agents_controller.rb +++ b/app/controllers/agents_controller.rb @@ -31,14 +31,15 @@ class AgentsController < ApplicationController end def type_details - agent = Agent.build_for_type(params[:type], current_user, {}) + @agent = Agent.build_for_type(params[:type], current_user, {}) render :json => { - :can_be_scheduled => agent.can_be_scheduled?, - :default_schedule => agent.default_schedule, - :can_receive_events => agent.can_receive_events?, - :can_create_events => agent.can_create_events?, - :options => agent.default_options, - :description_html => agent.html_description + :can_be_scheduled => @agent.can_be_scheduled?, + :default_schedule => @agent.default_schedule, + :can_receive_events => @agent.can_receive_events?, + :can_create_events => @agent.can_create_events?, + :options => @agent.default_options, + :description_html => @agent.html_description, + :form => render_to_string(partial: 'oauth_dropdown') } end diff --git a/app/views/agents/_form.html.erb b/app/views/agents/_form.html.erb index 3a30a362..b45ea4c3 100644 --- a/app/views/agents/_form.html.erb +++ b/app/views/agents/_form.html.erb @@ -31,12 +31,7 @@