2008-12-03 20:25:05 +01:00
<% context = context_listing
suppress_drag_handle ||= false
suppress_edit_button ||= false
%>
2007-03-30 04:36:52 +00:00
<div id="<%= dom_id(context, "container") %>" class="list">
<div id="<%= dom_id(context) %>" class="context sortable_row" style="display:'';">
2008-12-03 20:25:05 +01:00
<% unless suppress_drag_handle -%>
<div class="position">
<span class="handle">DRAG</span>
</div>
<% end -%>
2007-03-30 04:36:52 +00:00
<div class="data">
<%= link_to_context( context ) %> <%= " (" + count_undone_todos_phrase(context,"actions") + ")" %>
</div>
2007-11-17 21:12:34 +00:00
2007-03-30 04:36:52 +00:00
<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>
2007-12-03 03:24:05 +00:00
<%= apply_behavior "a.delete_context_button:click", { :prevent_default => true, :external => true} do |page, element|
2010-08-19 11:12:09 +02:00
page.confirming "Are you sure that you want to delete the context \"#{context.name}\"? Be aware that this will also delete all (repeating) actions in this context!" do
2007-12-03 03:24:05 +00:00
element.up('.context').start_waiting
page << remote_to_href(:method => 'delete')
end
2007-03-30 04:36:52 +00:00
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|
2007-11-17 21:12:34 +00:00
element.up('.context').toggle
editform = element.up('.list').down('.edit-form')
editform.toggle
editform.visual_effect(:appear)
editform.down('input').focus
2007-03-30 04:36:52 +00:00
end
-%>
</div>
</div>
2008-12-03 20:25:05 +01:00
<%= render :partial => 'contexts/context_form', :object => context %>
2010-08-19 11:00:33 +02:00
</div>