<%= javascript "compute_resource" %>
<%= form_for @compute_resource, :html => {:data => {:id => @compute_resource.try(:id)}} do |f| %>
  <%= base_errors_for @compute_resource %>

  <% if show_taxonomy_tabs? %>
    <ul class="nav nav-tabs" data-tabs="tabs">
      <li class="active"><a href="#primary" data-toggle="tab"><%= _("Compute Resource") %></a></li>
      <% if show_location_tab? %>
        <li><a href="#locations" data-toggle="tab"><%= _("Locations") %></a></li>
      <% end %>
      <% if show_organization_tab? %>
        <li><a href="#organizations" data-toggle="tab"><%= _("Organizations") %></a></li>
      <% end %>
    </ul>

    <div class="tab-content">
      <div class="tab-pane active" id="primary">
  <% end %>
        <%= text_f f, :name %>
        <%= f.hidden_field(:provider, :id => '') if f.object.uuid.present? %>
        <%= selectable_f f, :provider, ComputeResource::PROVIDERS, { :include_blank => _("Choose a provider")},
                         {:label => _("Provider"), :disabled=> f.object.uuid.present?, :'data-url'=> provider_selected_compute_resources_path, :onchange => 'providerSelected(this);'} %>
        <%= textarea_f f, :description, :rows => 3 %>
        <div id='compute_connection'>
          <%= render "compute_resources/form/#{@compute_resource.provider.downcase}", :f => f unless @compute_resource.provider.empty? %>
        </div>
    <% if show_taxonomy_tabs? %>
      </div>
      <% if show_location_tab? %>
        <div class="tab-pane" id="locations">
          <%= multiple_checkboxes f, :locations, @compute_resource, Location, :label => _("Locations") %>
        </div>
      <% end %>

    <% if show_organization_tab? %>
        <div class="tab-pane" id="organizations">
          <%= multiple_checkboxes f, :organizations, @compute_resource, Organization, :label => _("Organizations") %>
        </div>
      <% end %>
    </div>
  <% end %>

  <%= submit_or_cancel f %>
<% end %>
