mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-05 16:58:50 +01:00
fix failing scenario
This commit is contained in:
parent
8641ecfc4e
commit
9172d5e001
3 changed files with 20 additions and 10 deletions
|
|
@ -470,7 +470,7 @@ class TodosController < ApplicationController
|
|||
update_todo_state_if_project_changed
|
||||
|
||||
determine_changes_by_this_update
|
||||
determine_remaining_in_container_count(@context_changed || @project_changed ? @original_item : @todo)
|
||||
determine_remaining_in_container_count( (@context_changed || @project_changed) ? @original_item : @todo)
|
||||
determine_down_count
|
||||
determine_deferred_tag_count(params['_tag_name']) if source_view_is(:tag)
|
||||
|
||||
|
|
@ -1228,6 +1228,8 @@ class TodosController < ApplicationController
|
|||
project.name = params['project_name'].strip
|
||||
project.save
|
||||
@new_project_created = true
|
||||
@new_container = project
|
||||
@not_done_todos = [@todo]
|
||||
end
|
||||
end
|
||||
params["todo"]["project_id"] = project.id
|
||||
|
|
@ -1251,6 +1253,7 @@ class TodosController < ApplicationController
|
|||
@new_context.name = params['context_name'].strip
|
||||
@new_context.save
|
||||
@new_context_created = true
|
||||
@new_container = @new_context
|
||||
@not_done_todos = [@todo]
|
||||
context = @new_context
|
||||
end
|
||||
|
|
|
|||
|
|
@ -492,7 +492,7 @@ module TodosHelper
|
|||
end
|
||||
|
||||
def todo_moved_out_of_container
|
||||
return (@project_changed && @group_view_by=='project') || (@context_changed && @group_view_by='context')
|
||||
return (@project_changed && @group_view_by=='project') || (@context_changed && @group_view_by=='context')
|
||||
end
|
||||
|
||||
def update_needs_to_hide_container
|
||||
|
|
@ -526,6 +526,12 @@ module TodosHelper
|
|||
return false
|
||||
end
|
||||
|
||||
def update_needs_to_add_new_container
|
||||
needs_new_context = @new_context_created && (@group_view_by == "context")
|
||||
needs_new_project = @new_project_created && (@group_view_by == "project")
|
||||
return needs_new_project || needs_new_context
|
||||
end
|
||||
|
||||
def replace_with_updated_todo
|
||||
source_view do |page|
|
||||
page.context { return !update_needs_to_remove_todo_from_container }
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
if replace_with_updated_todo
|
||||
animation << "replace_todo"
|
||||
elsif append_updated_todo
|
||||
animation << (@new_context_created ? "insert_new_context_with_updated_todo" : "add_to_existing_container")
|
||||
animation << ( update_needs_to_add_new_container ? "insert_new_container_with_updated_todo" : "add_to_existing_container")
|
||||
end
|
||||
animation << "hide_container" if update_needs_to_hide_container
|
||||
animation << "highlight_updated_todo"
|
||||
|
|
@ -26,7 +26,6 @@
|
|||
TracksPages.page_notify('notice', '<%=escape_javascript @status_message%>', 5);
|
||||
TracksPages.set_page_badge(<%= @down_count %>);
|
||||
<%= render_animation(animation) %>
|
||||
<% end %>
|
||||
|
||||
function remove_todo(next_steps) {
|
||||
$('#<%= dom_id(@todo) %>').fadeOut(400, function() {
|
||||
|
|
@ -99,17 +98,17 @@ function update_badge_count() {
|
|||
TracksPages.set_page_badge(<%= count %>);
|
||||
}
|
||||
|
||||
function insert_new_context_with_updated_todo(next_steps) {
|
||||
$('#display_box').prepend(html_for_new_context());
|
||||
function insert_new_container_with_updated_todo(next_steps) {
|
||||
$('#display_box').prepend(html_for_new_container());
|
||||
$('#<%= item_container_id(@todo) %>').fadeIn(500, function() { next_steps.go(); });
|
||||
}
|
||||
|
||||
function html_for_todo() {
|
||||
return "<%= @saved ? escape_javascript(render(:partial => @todo, :locals => { :parent_container_type => parent_container_type })) : "" %>";
|
||||
return "<%= escape_javascript(render(:partial => @todo, :locals => { :parent_container_type => parent_container_type })) %>";
|
||||
}
|
||||
|
||||
function html_for_new_context() {
|
||||
return "<%= @saved && @new_context_created ? escape_javascript(render(:partial => @new_context, :locals => { :settings => {:collapsible => true }})) : "" %>";
|
||||
function html_for_new_container() {
|
||||
return "<%= ( @new_context_created || @new_project_created ) ? escape_javascript(render(:partial => @new_container, :locals => { :settings => {:collapsible => true }})) : "" %>";
|
||||
}
|
||||
|
||||
function update_predecessors(next_steps) {
|
||||
|
|
@ -135,4 +134,6 @@ function regenerate_predecessor_family() {
|
|||
<%
|
||||
end
|
||||
-%>
|
||||
}
|
||||
}
|
||||
|
||||
<% end %>
|
||||
Loading…
Add table
Add a link
Reference in a new issue