<div class="content nodeFormContainer">
    <%= form(:action => form_url, :method => :post, :id => form_id, :class => 'form') do -%>
    <% unless form_for == 'edit' %>
      <div class="group form">
        <label class="label" for="node_name">Name</label>
        <%= text_field :id => "node_name", :name => "name", :class => "text_field", :value => params.has_key?(:name) ? h(params[:name]) : @node.name %>
        <span class="description">The name of the Node</span>
      </div>
    <% end %>

    <div>
      <label class="label" for="nodeEnvironment">Environment:</label>
      <%= select :chef_environment, :collection => @environments, :id => 'nodeEnvironment', :selected => @env %>
      <br />
      <span class="description">The node's environment</span>
    </div>

    <div class="group form" id="run_list_editor_container">
      <div id="availableRunListItemContainer" class="runListEditorColumn">
        <div id="available_roles_container" class="runListItemListContainer">
          <div class="runListEditorLabel">Available Roles</div>
          <div class="sortable runListAvailableItemContainer">
            <ul id="node_available_roles" class="connectedSortable runListAvailableItemList">
              <% @available_roles.each do |role| %>
                <li id="role[<%=h(role)  -%>]" class="ui-state-highlight runListItem"><%= h(role) -%></li>
              <% end %>
            </ul>
          </div>
        </div>
        <div id="available_recipes_container" class="runListItemListContainer">
          <div class="runListEditorLabel">Available Recipes</div>
          <div class="sortable runListAvailableItemContainer">
            <ul id="node_available_recipes" class="connectedSortable runListAvailableItemList availableRecipes">
              <% @available_recipes.each do |recipe| %>
                <li id="recipe[<%= h(recipe) -%>]" class="ui-state-default runListItem"><%= h(recipe) -%></li>
              <% end %>
            </ul>
          </div>
        </div>
      </div>
      <div id="run_list_container" class="runListEditorColumn">
        <div class="runListItemListContainer">
          <div class="runListEditorLabel">Run List</div>
          <div class="sortable runListContainer runListContainerForNode">
            <ul class="ui-sortable connectedSortable runListItemList" id="for_node">
              <% @run_list.each do |entry| %>
                <li id="<%=h(entry)%>" class="<%= class_for_run_list_item(entry) -%> runListItem"><%=h(entry.name) -%></li>
              <% end %>
            </ul>
          </div>
        </div>
      </div>
    </div>

    <div class="group form attrEditor">
      <label class="label">Attributes</label>
      <%= partial 'layout/jsonedit', :json => @node.normal_attrs.to_json %>
      <span class="description">
        A JSON hash for default attributes for nodes of this node.  These attributes will only be applied if the node does not already have a value for the attributes.
      </span>
    </div>

    <div class="group">
      <div class="actions-bar">
        <%= submit(submit_name, :id => submit_id, :class => 'button') -%>
      </div>
    </div>
  <% end =%>
</div>
