Merge remote-tracking branch 'dsander/omniauth' into omniauth_refactors

Conflicts:
	app/views/agents/_form.html.erb
This commit is contained in:
Andrew Cantino 2014-08-10 16:37:56 -07:00
commit 35e8e4cc17
4 changed files with 16 additions and 14 deletions

View file

@ -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

View file

@ -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

View file

@ -31,12 +31,7 @@
</div>
<div class='oauthable-form'>
<% if @agent.try(:oauthable?) %>
<div class="form-group type-select">
<%= f.label :service %>
<%= f.select :service_id, options_for_select(@agent.valid_services_for(current_user).collect { |s| ["(#{s.provider}) #{s.name}", s.id]}, @agent.service_id), {}, class: 'form-control' %>
</div>
<% end %>
<%= render partial: 'oauth_dropdown' %>
</div>
<div class="form-group">

View file

@ -0,0 +1,6 @@
<% if @agent.try(:oauthable?) %>
<div class="form-group type-select">
<%= label_tag :service %>
<%= select_tag 'agent[service_id]', options_for_select(@agent.valid_services(current_user).collect { |s| ["(#{s.provider}) #{s.name}", s.id]}, @agent.service_id), class: 'form-control' %>
</div>
<% end %>