<%= form_for @domain, :url => (@domain.new_record? ? domains_path : domain_path(:id => @domain.id)) do |f| %>
  <%= base_errors_for @domain %>
  <ul class="nav nav-tabs" data-tabs="tabs">
    <li class="active"><a href="#primary" data-toggle="tab"><%= _("Domain") %></a></li>
    <li><a href="#params" data-toggle="tab"><%= _("Parameters") %></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">
      <%= text_f   f, :name, :help_inline => _("The full DNS Domain name") %>
      <%= text_f   f, :fullname, :help_inline => _("Full name describing the domain") %>
      <%= select_f f, :dns_id, Feature.find_by_name("DNS").smart_proxies, :id, :name,
        {:include_blank => _("None")}, {:label => _("DNS Proxy"), :help_inline => _("DNS Proxy to use within this domain")}
      %>
    </div>

    <div class="tab-pane" id="params">
      <%= render "common_parameters/parameters", { :f => f, :type => :domain_parameters } %>
    </div>

    <% if show_location_tab? %>
      <div class="tab-pane" id="locations">
        <%= multiple_checkboxes f, :locations, @domain, Location, :label => _("Locations") %>
      </div>
    <% end %>

    <% if show_organization_tab? %>
      <div class="tab-pane" id="organizations">
        <%= multiple_checkboxes f, :organizations, @domain, Organization, {},
          { :disabled => Array.wrap(Organization.current.try(:id)), :label => _("Organizations") } %>
      </div>
    <% end %>

  </div>

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