diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index ca830024..be28052f 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -512,18 +512,18 @@ module TodosHelper end def update_needs_to_hide_container - if source_view_is(:tag) + if source_view_is_one_of(:tag, :context, :project) return @remaining_in_context == 0 && ( todo_moved_out_of_container || (@todo_hidden_state_changed && @todo.hidden?) || @todo_was_deferred_from_active_state || @tag_was_removed || @todo_was_destroyed || - (@todo.completed? && !(@original_item_was_deferred || @original_item_was_hidden)) + (@todo.completed? && !(@original_item_was_deferred || @original_item_was_hidden || @original_item_was_pending)) ) end - return false if source_view_is_one_of(:project, :calendar, :done, :context) + return false if source_view_is_one_of(:calendar, :done) return @remaining_in_context == 0 end @@ -599,7 +599,7 @@ module TodosHelper end def todo_container_empty_id(todo) - raise Exception.new, "no todo set in TodosHelper::todo_container_empty_id. You probably not assign @original_item" if !todo + raise Exception.new, "no todo set in TodosHelper::todo_container_empty_id. You probably did not assign @original_item" if !todo @group_view_by == "project" ? project_container_empty_id(todo) : context_container_empty_id(todo) end @@ -609,8 +609,7 @@ module TodosHelper return "#{@new_due_id}_container" if source_view_is :calendar return "deferred_pending_container" if !source_view_is(:todo) && (todo.deferred? || todo.pending?) return "completed_container" if todo.completed? - return "p#{todo.project_id}" if source_view_is :project - return project_container_id(todo) if source_view_is_one_of(:todo, :tag) && @group_view_by == 'project' + return project_container_id(todo) if source_view_is_one_of(:todo, :tag, :project, :context) && @group_view_by == 'project' return context_container_id(todo) end @@ -620,7 +619,7 @@ module TodosHelper source_view do |page| page.project { return "deferred_pending_container-empty-d" if empty_criteria_met - return project_container_empty_id(todo) + return todo_container_empty_id(todo) } page.tag { return "deferred_pending_container-empty-d" if empty_criteria_met @@ -633,7 +632,7 @@ module TodosHelper } page.context { return "deferred_pending_container-empty-d" if empty_criteria_met - return context_container_empty_id(todo) + return todo_container_empty_id(todo) } page.todo { return todo_container_empty_id(todo) diff --git a/app/views/contexts/show.html.erb b/app/views/contexts/show.html.erb index 0c6c5d1e..fe44d124 100644 --- a/app/views/contexts/show.html.erb +++ b/app/views/contexts/show.html.erb @@ -5,10 +5,14 @@ show_empty_containers = (@group_view_by == 'context') -%>
+ + <%= empty_message_holder("not_done_project", @not_done_todos.empty?) %> + <%= show_grouped_todos({:collapsible => false, :show_empty_containers => show_empty_containers, :parent_container_type => 'context'}) %> - <% if @group_view_by == 'project' -%> - <%= show_todos_without_project(@todos_without_project, {:collapsible => false, :parent_container_type => 'context', :title_param => @context.name}) -%> - <% end -%> + + <% if @group_view_by == 'project' -%> + <%= show_todos_without_project(@todos_without_project, {:collapsible => false, :parent_container_type => 'context', :title_param => @context.name}) -%> + <% end -%> <%= show_deferred_pending_todos(@deferred_todos, @pending_todos, deferred_pending_options) %> diff --git a/app/views/projects/show.html.erb b/app/views/projects/show.html.erb index 6b777649..e75110bb 100644 --- a/app/views/projects/show.html.erb +++ b/app/views/projects/show.html.erb @@ -9,14 +9,15 @@ # force project view so one empty container will be shown with an empty message @group_view_by = 'project' end - show_empty_containers = (@group_view_by == 'project') -%>
<%= project_next_prev %> <%= render :partial => "project_settings_container", :locals => {:project => @project} %> - <%= show_grouped_todos({:collapsible => false, :show_empty_containers => show_empty_containers, :parent_container_type => 'project' }) %> + <%= empty_message_holder("not_done_context", @not_done_todos.empty?) %> + + <%= show_grouped_todos({:collapsible => false, :show_empty_containers => false, :parent_container_type => 'project' }) %> <%= show_deferred_pending_todos(@deferred_todos, @pending_todos, deferred_pending_options) %> diff --git a/app/views/todos/toggle_check.js.erb b/app/views/todos/toggle_check.js.erb index 4600d6aa..17567222 100644 --- a/app/views/todos/toggle_check.js.erb +++ b/app/views/todos/toggle_check.js.erb @@ -15,7 +15,7 @@ animation << "add_todo_to_container" unless source_view_is(:done) animation << "block_predecessors" end - animation << "update_empty_container" if source_view_is_one_of(:tag, :todo, :deferred) + animation << "update_empty_container" if source_view_is_one_of(:tag, :todo, :deferred, :project, :context) animation << "regenerate_predecessor_family" else animation << "replace_todo" @@ -63,15 +63,14 @@ function replace_todo(next_steps) { } function add_todo_to_container(next_steps) { - // <%= @group_view_by %> $('#<%= item_container_id(@todo) %>_items').append(html_for_todo()); <% if should_make_context_visible -%> $('#<%= item_container_id(@todo) %>').slideDown(500, function() { - $("#<%= empty_container_msg_div_id %>").slideUp(100); + $("#<%= empty_container_msg_div_id %>").slideUp(100); highlight_updated_todo(next_steps); }); <% else -%> - $("#<%= empty_container_msg_div_id(@todo) %>").slideUp(100); + $("#<%= empty_container_msg_div_id(@todo) %>").slideUp(100); highlight_updated_todo(next_steps); <% end -%> <% if @completed_count == 0 -%> @@ -120,7 +119,7 @@ function highlight_updated_todo(next_steps) { function activate_pending_todos(next_steps) { <% # Activate pending todos that are successors of the completed - if @saved && @pending_to_activate + if @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 })) @@ -173,7 +172,7 @@ end function html_for_recurring_todo() { <%- - js = @saved && @new_recurring_todo ? escape_javascript(render(:partial => @new_recurring_todo, :locals => { :parent_container_type => parent_container_type })) : "" + js = @new_recurring_todo ? escape_javascript(render(:partial => @new_recurring_todo, :locals => { :parent_container_type => parent_container_type })) : "" -%> return "<%= js %>"; } @@ -181,7 +180,7 @@ function html_for_recurring_todo() { function html_for_todo() { <%- js = "" - if @saved && !source_view_is(:done) + if !source_view_is(:done) js = escape_javascript(render( :partial => @todo, :locals => { diff --git a/app/views/todos/update.js.erb b/app/views/todos/update.js.erb index 54cb4171..7cd718c4 100644 --- a/app/views/todos/update.js.erb +++ b/app/views/todos/update.js.erb @@ -20,7 +20,7 @@ end animation << "hide_container" if update_needs_to_hide_container animation << "highlight_updated_todo" - animation << "update_empty_container" if source_view_is_one_of(:tag, :todo, :deferred) + animation << "update_empty_container" if source_view_is_one_of(:tag, :todo, :deferred, :project, :context) animation << "update_predecessors" %> TracksPages.page_notify('notice', '<%=escape_javascript @status_message%>', 5); diff --git a/config/locales/en.yml b/config/locales/en.yml index 7e430a3e..fb4c3201 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -435,6 +435,8 @@ en: completed: Currently there are no completed actions title: No actions found not_done_with_tag: "Currently there are no incomplete actions with the tag '%{param}'" + not_done_project: Currently there are no incomplete actions in this project + not_done_context: Currently there are no incomplete actions in this context completed_recurring: Currently there are no completed recurring todos not_done: Currently there are no incomplete actions project: Currently there are no incomplete actions in this project diff --git a/features/dependencies.feature b/features/dependencies.feature index 0fc1a6bd..da87e0eb 100644 --- a/features/dependencies.feature +++ b/features/dependencies.feature @@ -68,10 +68,10 @@ Feature: dependencies And "test 2" depends on "test 1" When I go to the "dependencies" project Then I should see "test 2" in the deferred container - And I should see "test 1" in the action container + And I should see "test 1" in the context container for "@pc" When I mark "test 1" as complete Then I should see "test 1" in the completed container - And I should see "test 2" in the action container + And I should see "test 2" in the context container for "@pc" And I should not see "test 2" in the deferred container And I should see empty message for deferred todos of project @@ -86,9 +86,9 @@ Feature: dependencies And "test 2" depends on "test 1" When I go to the "dependencies" project Then I should see "test 2" in the deferred container - And I should see "test 1" in the action container + And I should see "test 1" in the context container for "@pc" When I delete the action "test 1" - Then I should see "test 2" in the action container + Then I should see "test 2" in the context container for "@pc" And I should not see "test 2" in the deferred container And I should see empty message for deferred todos of project @@ -111,7 +111,7 @@ Feature: dependencies Then I should see "test 3" within the dependencies of "test 1" And I should not see "test 2" - @javascript + @javascript Scenario: Dragging an action to a completed action will not add it as a dependency Given I have a context called "@pc" And I have a project "dependencies" that has the following todos @@ -122,7 +122,7 @@ Feature: dependencies When I go to the "dependencies" project And I drag "test 1" to "test 3" Then I should see an error flash message saying "Cannot add this action as a dependency to a completed action!" - And I should see "test 1" in the project container of "dependencies" + And I should see "test 1" in the context container for "@pc" @javascript Scenario Outline: Marking a successor as complete will update predecessor @@ -148,7 +148,7 @@ Feature: dependencies | tag page for "bla" | context | | tag page for "bla" | project | - @javascript + @javascript Scenario Outline: Marking a successor as active will update predecessor Given I have a context called "@pc" And I have selected the view for group by @@ -171,5 +171,6 @@ Feature: dependencies Scenarios: | page | grouping | | "dependencies" project | project | + | "dependencies" project | context | | tag page for "bla" | context | | tag page for "bla" | project | \ No newline at end of file diff --git a/features/edit_a_todo.feature b/features/edit_a_todo.feature index 6ff71fa2..33326e3d 100644 --- a/features/edit_a_todo.feature +++ b/features/edit_a_todo.feature @@ -55,7 +55,7 @@ Feature: Edit a next action from every page @javascript @wip Scenario Outline: Changing container of the todo in that container will hide it # this script fails on https://code.google.com/p/selenium/issues/detail?id=3075 for selenium-webdriver > 2.14. - # and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This may work on webkit though + # and selenium-webdriver < 2.20 fails on firefox 11 :-( So @wip for now. This may work with webkit though Given I have a todo "delete me" in the context "@home" in the project "do it" And I have a project "go for it" And I have selected the view for group by @@ -77,6 +77,7 @@ Feature: Edit a next action from every page @javascript Scenario Outline: Deleting the last todo in container will show empty message # only project, context, tag, not todo Given I have a context called "@home" + And I have selected the view for group by And I have a project "my project" that has the following todos | context | description | tags | | @home | first action | test, bla | @@ -90,12 +91,15 @@ Feature: Edit a next action from every page Then I should see empty message for todos of Scenarios: - | page | page type | - | "my project" project | project | - | context page for "@home" | context | - | tag page for "bla" | tag | + | page | page type | grouping | + | "my project" project | project | project | + | "my project" project | project | context | + | context page for "@home" | context | context | + | context page for "@home" | context | project | + | tag page for "bla" | tag | context | + | tag page for "bla" | tag | project | - @javascript + @javascript Scenario Outline: I can mark an active todo complete and it will update empty messages Given I have a context called "visible context" And I have a project called "visible project" @@ -134,7 +138,7 @@ Feature: Edit a next action from every page | "visible project" project | project | | context page for "visible context" | context | - @javascript + @javascript Scenario Outline: I can mark a completed todo active and it will update empty messages and context containers Given I have a completed todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context" And I have selected the view for group by @@ -155,8 +159,8 @@ Feature: Edit a next action from every page | home page | home | context | container for context "visible context" | | home page | home | project | container for project "visible project" | - @javascript - Scenario Outline: I can mark a completed todo active and it will update empty messages for pages without context containers + @javascript + Scenario Outline: I can mark a completed todo active and it will update empty messages for pages without hideable containers Given I have a completed todo with description "visible todo" in project "visible project" with tags "starred" in the context "visible context" When I go to the Then I should see empty message for todos of diff --git a/features/project_edit.feature b/features/project_edit.feature index 1420db21..412cb42d 100644 --- a/features/project_edit.feature +++ b/features/project_edit.feature @@ -123,7 +123,7 @@ Feature: Edit a project Scenario: Moving the todo to the tickler will move todo to tickler container and update empty messages Given I have a project "test" with 1 todos When I go to the "test" project - Then I should see "todo 1" in the action container + Then I should see "todo 1" in the context container for "Context A" And I should see empty message for deferred todos of project And I should see empty message for completed todos of project When I defer "todo 1" for 1 day diff --git a/features/shared_add_new_todo.feature b/features/shared_add_new_todo.feature index 5c5c838a..71c5b724 100644 --- a/features/shared_add_new_todo.feature +++ b/features/shared_add_new_todo.feature @@ -97,7 +97,9 @@ Feature: Add new next action from every page | tickler page | context | not see | | tickler page | project | not see | | "test project" project | context | see | + | "test project" project | project | see | | context page for "test context" | context | see | + | context page for "test context" | project | see | | tag page for "starred" | context | see | | tag page for "starred" | project | see | @@ -124,7 +126,9 @@ Feature: Add new next action from every page | tickler page | not see | 0 | 3 | context | | tickler page | not see | 0 | 3 | project | | "testing" project | see | 3 | 3 | context | + | "testing" project | see | 3 | 3 | project | | context page for "test context" | see | 2 | 3 | context | + | context page for "test context" | see | 2 | 3 | project | | tag page for "starred" | see | 2 | 3 | context | | tag page for "starred" | see | 2 | 3 | project | @@ -199,9 +203,13 @@ Feature: Add new next action from every page | tickler page | context | not see | not see | | tickler page | project | not see | not see | | "visible project" project | project | not see | see | + | "visible project" project | context | not see | see | | "hidden project" project | project | see | not see | + | "hidden project" project | context | see | not see | | context page for "visible context" | context | not see | see | + | context page for "visible context" | project | not see | see | | context page for "other context" | context | not see | not see | + | context page for "other context" | project | not see | not see | | tag page for "starred" | context | not see | not see | | tag page for "starred" | project | not see | not see | | tag page for "test" | context | see | see | diff --git a/features/step_definitions/container_steps.rb b/features/step_definitions/container_steps.rb index c487aa5a..0fa984a3 100644 --- a/features/step_definitions/container_steps.rb +++ b/features/step_definitions/container_steps.rb @@ -91,7 +91,6 @@ Then(/^I should (not see|see) "([^"]*)" in the (completed|done today|done this w id = 'completed_rest_of_month_container' if container == 'done this month' css = "div##{id} div#line_todo_#{find_todo(todo_description).id}" - page.should have_css(css) check_css_visibility(visible, css) end @@ -138,9 +137,8 @@ end Then /^I should (see|not see) empty message for (done today|done this week|done this month|completed todos|deferred todos|todos) (of done actions|of context|of project|of home|of tag)/ do |visible, state, type| css = "error: wrong state" - css = "div#c#{@context.id}-empty-d" if state == "todos" && type == "of context" - css = "div#p#{@project.id}-empty-d" if state == "todos" && type == "of project" - css = "div#no_todos_in_view" if state == "todos" && (type == "of home" || type == "of tag") + css = "div#c#{@context.id}-empty-d" if state == "todos" + css = "div#no_todos_in_view" if state == "todos" && ["of home", "of tag", "of context", "of project"].include?(type) css = "div#completed_today_container" if state == "done today" css = "div#completed_rest_of_week_container" if state == "done this week" css = "div#completed_rest_of_month_container" if state == "done this month" diff --git a/features/step_definitions/todo_create_steps.rb b/features/step_definitions/todo_create_steps.rb index 5b5f93c7..d98172e0 100644 --- a/features/step_definitions/todo_create_steps.rb +++ b/features/step_definitions/todo_create_steps.rb @@ -70,9 +70,9 @@ Given /^I have ([0-9]+) todos$/ do |count| end Given /^I have a todo with description "([^"]*)" in project "([^"]*)" with tags "([^"]*)" in the context "([^"]*)"$/ do |action_description, project_name, tags, context_name| - context = @current_user.contexts.where(:name => context_name).first_or_create - project = @current_user.projects.where(:name => project_name).first_or_create - @todo = @current_user.todos.create!(:context_id => context.id, :project_id => project.id, :description => action_description) + @context = @current_user.contexts.where(:name => context_name).first_or_create + @project = @current_user.projects.where(:name => project_name).first_or_create + @todo = @current_user.todos.create!(:context_id => @context.id, :project_id => @project.id, :description => action_description) @todo.tag_with(tags) @todo.save end