fix tests for dependencies and fix minor issues

This commit is contained in:
Reinier Balt 2011-03-08 23:28:48 +01:00
parent 533e26d953
commit bb6269f81c
15 changed files with 571 additions and 434 deletions

View file

@ -447,7 +447,7 @@ class TodosController < ApplicationController
format.js do
if @saved
determine_down_count
if source_view_is_one_of(:todo, :deferred)
if source_view_is_one_of(:todo, :deferred, :project)
determine_remaining_in_context_count(@context_id)
elsif source_view_is :calendar
@original_item_due_id = get_due_id_for_calendar(@original_item_due)

View file

@ -90,7 +90,7 @@ module TodosHelper
end
def remote_toggle_checkbox(todo=@todo)
check_box_tag('item_id', toggle_check_todo_path(todo), todo.completed?, :class => 'item-checkbox',
check_box_tag("mark_complete_#{todo.id}", toggle_check_todo_path(todo), todo.completed?, :class => 'item-checkbox',
:title => todo.pending? ? t('todos.blocked_by', :predecessors => todo.uncompleted_predecessors.map(&:description).join(', ')) : "", :readonly => todo.pending?)
end

View file

@ -1,5 +1,5 @@
<%- if @saved -%>
TracksPages.page_notify('notice', '<%= escape_javascript("The action was deleted succesfully") %>', 5);
TracksPages.page_notify('notice', '<%= escape_javascript(t('todos.deleted_success')) %>', 5);
TracksPages.set_page_badge(<%=@down_count%>);
remove_todo_from_page();
show_new_todo_if_todo_was_recurring();
@ -59,14 +59,24 @@ function show_new_todo_if_todo_was_recurring() {
}
function activate_pending_todos() {
<% # Activate pending todos that are successors of the deleted -%>
<% @pending_to_activate.each do |t| -%>
<% if source_view_is(:project) or source_view_is(:tag) %>
$('#<%=dom_id(t)%>').remove();
<% end -%>
$('#<%=item_container_id(t)%>').append("<%=escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))%>");
$('#<%= dom_id(t, 'line')%>').effect('highlight', {}, 2000 );
<% end -%>
<% # Activate pending todos that are successors of the completed
if @saved && @pending_to_activate
# do not render the js in case of an error or if no todos to activate
@pending_to_activate.each do |t|
html = escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))
# only project and tag view have a deferred/blocked container
if source_view_is_one_of(:project,:tag) -%>
$('#<%= dom_id(t) %>').fadeOut(400, function() {
$('#<%= dom_id(t) %>').remove();
$('#<%= item_container_id(t) %>').append("<%= html %>");
<%= "$('#tickler-empty-nd').show();" if @remaining_deferred_or_pending_count==0 -%>
});
<% else -%>
$('#<%= item_container_id(t) %>').append("<%= html%>");
<% end -%>
TodoItems.highlight_todo('#<%= dom_id(t, 'line')%>');
<% end -%>
<% end -%>
}
function html_for_new_recurring_todo() {

View file

@ -95,32 +95,33 @@ function update_empty_tag_container(next_steps) {
<% if @new_recurring_todo # hide js if @new_recurring_todo is not there-%>
function highlight_updated_recurring_todo(next_steps) {
highlight_todo('#<%= dom_id(@new_recurring_todo)%>');
TodoItems.highlight_todo('#<%= dom_id(@new_recurring_todo)%>');
next_steps.go();
}
<% end -%>
function highlight_updated_todo(next_steps) {
highlight_todo('#<%= dom_id(@todo)%>');
TodoItems.highlight_todo('#<%= dom_id(@todo)%>');
next_steps.go();
}
function highlight_todo(id) {
$(id).effect('highlight', {}, 2000, function(){ });
}
function activate_pending_todos(next_steps) {
<% # Activate pending todos that are successors of the completed
if @saved && @pending_to_activate
# do not render the js in case of an error or if no todos to activate
@pending_to_activate.each do |t|
html = escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))
# only project and tag view have a deferred/blocked container
if source_view_is_one_of(:project,:tag) -%>
$('#<%= dom_id(t) %>').fadeOut(400, function() {
$('#<%= dom_id(t) %>').remove();
$('#<%= item_container_id(t) %>').append("<%= html %>");
<%= "$('#tickler-empty-nd').show();" if @remaining_deferred_or_pending_count==0 -%>
});
<% end -%>
$('#<%= item_container_id(t) %>').append("<%= escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))%>");
highlight_todo('#<%= dom_id(t)%>');
<% else -%>
$('#<%= item_container_id(t) %>').append("<%= html%>");
<% end -%>
TodoItems.highlight_todo('#<%= dom_id(t)%>');
<% end -%>
<% end -%>
next_steps.go();
@ -135,7 +136,7 @@ function block_predecessors(next_steps) {
$('#<%= dom_id(t) %>').remove();
<% if source_view_is(:project) or source_view_is(:tag) # Insert it in deferred/pending block if existing -%>
$('#<%= item_container_id(t) %>').append("<%= escape_javascript(render(:partial => t, :locals => { :parent_container_type => parent_container_type }))%>");
highlight_todo('#<%= dom_id(t)%>');
TodoItems.highlight_todo('#<%= dom_id(t)%>');
<% end -%>
});
<% end -%>