2011-03-11 21:01:24 +01:00
|
|
|
<% if !@saved
|
2014-08-10 20:43:27 +02:00
|
|
|
if @predecessor.completed? -%>
|
|
|
|
|
TracksPages.page_error("<%= t('todos.cannot_add_dependency_to_completed_todo') %>");
|
|
|
|
|
$('#<%=dom_id(@todo)%>').html(html_for_todo());
|
|
|
|
|
<% else -%>
|
|
|
|
|
TracksPages.page_error("<%= t('todos.unable_to_add_dependency') %>");
|
|
|
|
|
<% end
|
2011-03-11 21:01:24 +01:00
|
|
|
else -%>
|
2011-01-24 10:07:24 +01:00
|
|
|
remove_successor_from_page();
|
|
|
|
|
replace_updated_predecessor();
|
|
|
|
|
regenerate_predecessor_family();
|
2012-12-25 15:46:26 +01:00
|
|
|
<%= "show_in_tickler_box();".html_safe if source_view_is_one_of :project, :tag, :context %>
|
2014-08-10 20:43:27 +02:00
|
|
|
TracksPages.page_inform("<%= @status_message %>");
|
2009-07-19 15:41:34 +02:00
|
|
|
|
2011-01-24 10:07:24 +01:00
|
|
|
function remove_successor_from_page() {
|
2014-08-10 20:43:27 +02:00
|
|
|
<% # TODO: last todo in context --> remove context?? -%>
|
2011-01-24 10:07:24 +01:00
|
|
|
$('#<%=dom_id(@todo)%>').remove();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function replace_updated_predecessor() {
|
|
|
|
|
$('#<%= dom_id(@predecessor) %>').html( html_for_predecessor() );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function show_in_tickler_box() {
|
2013-03-17 15:41:36 +01:00
|
|
|
$("#deferred_pending_container-empty-d").hide();
|
|
|
|
|
$('#deferred_pending_container').append( html_for_todo() );
|
2011-01-24 10:07:24 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function regenerate_predecessor_family() {
|
|
|
|
|
<%
|
2014-04-11 22:47:36 +02:00
|
|
|
parents = @predecessors.to_a
|
2010-03-14 12:29:43 -04:00
|
|
|
until parents.empty?
|
|
|
|
|
parent = parents.pop
|
2011-01-24 10:07:24 +01:00
|
|
|
parents += parent.predecessors -%>
|
2014-08-10 20:43:27 +02:00
|
|
|
$('#<%= dom_id(parent) %>').html("<%= js_render(parent, { :parent_container_type => parent_container_type }) %>");
|
|
|
|
|
<%end-%>
|
2011-01-24 10:07:24 +01:00
|
|
|
}
|
2010-03-06 18:43:59 -05:00
|
|
|
|
2011-01-24 10:07:24 +01:00
|
|
|
function html_for_predecessor() {
|
2014-08-10 20:43:27 +02:00
|
|
|
return "<%= js_render(@predecessor, { :parent_container_type => parent_container_type }) %>";
|
2011-01-24 10:07:24 +01:00
|
|
|
}
|
2009-11-10 22:15:16 -05:00
|
|
|
|
2011-03-11 21:01:24 +01:00
|
|
|
<% end # if !@saved
|
|
|
|
|
|
|
|
|
|
# following js is needed in case of an error with dragging onto a completed action althoug
|
|
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
function html_for_todo() {
|
2014-08-10 20:43:27 +02:00
|
|
|
return "<%= js_render(@todo, { :parent_container_type => parent_container_type }) %>";
|
|
|
|
|
}
|