<%  context = context_listing %>
<div id="<%= dom_id(context, "container") %>" class="list">
  <div id="<%= dom_id(context) %>" class="context sortable_row" style="display:'';">
    <div class="position">
      <span class="handle">DRAG</span>
    </div>
    <div class="data">
      <%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
    </div>
    
    <div class="buttons">
      <% if context.hide? %>
        <span class="grey">HIDDEN</span>
      <% else %>
        <span class="grey">VISIBLE</span>
      <% end %>
      <a class="delete_context_button" href="<%= formatted_context_path(context, :js) %>" title="delete the context '<%= context.name %>'"><%= image_tag( "blank.png", :title => "Delete context", :class=>"delete_item") %></a>
      <%= apply_behavior "a.delete_context_button:click", { :prevent_default => true, :external => true} do |page, element|
               page.confirming "'Are you sure that you want to ' + this.title + '?'" do
                 element.up('.context').start_waiting
                 page << remote_to_href(:method => 'delete')
               end
         end -%>
      <a class="edit_context_button" href="#"><%= image_tag( "blank.png", :title => "Edit context", :class=>"edit_item") %></a>
      <%= apply_behavior 'a.edit_context_button:click', :prevent_default => true do |page, element|
               element.up('.context').toggle 
               editform = element.up('.list').down('.edit-form')
               editform.toggle 
               editform.visual_effect(:appear) 
               editform.down('input').focus
         end
      -%>
    </div>
  </div>
  <%= render :partial => 'context_form', :object => context %>
</div>