%= form_for(@agent,
:as => :agent,
:url => @agent.new_record? ? agents_path : agent_path(@agent),
:method => @agent.new_record? ? "POST" : "PUT") do |f| %>
<% if @agent.errors.any? %>
<%= pluralize(@agent.errors.count, "error") %> prohibited this Agent from being saved:
<% @agent.errors.full_messages.each do |msg| %>
- <%= msg %>
<% end %>
<% end %>
<%= @agent.html_description unless @agent.new_record? %>
<% if @agent.new_record? %>
<%= image_tag "spinner-arrows.gif", :class => "spinner" %>
<%= f.label :type, :class => 'control-label' %>
<%= f.select :type, options_for_select(Agent.types.map {|type| [type.to_s.gsub(/^.*::/, ''), type.to_s] }, @agent.type), :class => 'span4' %>
<% end %>
<%= f.label :name, :class => 'control-label' %>
<%= f.text_field :name, :class => 'span4' %>
<%= f.label :schedule, :class => 'control-label' %>
<%= f.select :schedule, options_for_select(Agent::SCHEDULES.map {|s| [s.humanize.titleize, s] }, @agent.schedule), :class => 'span4' %>
This type of Agent cannot be scheduled.
<%= f.label :sources, :class => 'control-label' %>
<%= f.select(:source_ids,
options_for_select((current_user.agents - [@agent]).map {|s| [s.name, s.id] },
@agent.source_ids),
{}, { :multiple => true, :size => 5, :class => 'span4 multi-select' }) %>
This type of Agent cannot receive events.
<%= f.label :options, :class => 'control-label' %>
<%= f.submit :class => "btn btn-primary" %>
<% end %>