diff --git a/app/helpers/todos_helper.rb b/app/helpers/todos_helper.rb index 397d0803..f9eb6cd5 100644 --- a/app/helpers/todos_helper.rb +++ b/app/helpers/todos_helper.rb @@ -128,6 +128,18 @@ module TodosHelper end end + def todos_calendar_container(period, collection) + render :partial => 'todos/collection', + :object => collection, + :locals => {:settings => { + :collapsible => false, + :show_empty_containers => true, + :container_name => "#{period}", + :title =>t("todos.calendar.#{period}", :month => l(Time.zone.now, :format => "%B")) + } + } + end + # === helpers for rendering a todo def remote_star_icon(todo=@todo) @@ -548,13 +560,13 @@ module TodosHelper end def item_container_id (todo) - return "hidden_container_items" if source_view_is(:tag) && todo.hidden? - return "c#{todo.context_id}_items" if source_view_is :deferred - return @new_due_id if source_view_is :calendar - return "deferred_pending_container_items" if !source_view_is(:todo) && (todo.deferred? || todo.pending?) - return "completed_container_items" if todo.completed? - return "p#{todo.project_id}_items" if source_view_is :project - return project_container_id(todo) if source_view_is_one_of(:todo, :tag) && @group_view_by == 'project' + return "hidden_container" if source_view_is(:tag) && todo.hidden? + return "c#{todo.context_id}" if source_view_is :deferred + 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 "c#{todo.context_id}" end @@ -574,7 +586,7 @@ module TodosHelper } page.calendar { return "deferred_pending_container-empty-d" if empty_criteria_met - return "empty_#{@new_due_id}" + return "#{@new_due_id}_container-empty-d" } page.context { return "deferred_pending_container-empty-d" if empty_criteria_met @@ -613,8 +625,8 @@ module TodosHelper container_id = "deferred_pending_container-empty-d" if todo_was_removed_from_deferred_or_blocked_container && @remaining_deferred_or_pending_count == 0 container_id = "completed_container-empty-d" if @completed_count && @completed_count == 0 && !@todo.completed? } - page.deferred { container_id = "c#{@original_item_context_id}empty-d" if @remaining_in_context == 0 } - page.calendar { container_id = "empty_#{@original_item_due_id}" if @old_due_empty } + page.deferred { container_id = "c#{@original_item_context_id}-empty-d" if @remaining_in_context == 0 } + page.calendar { container_id = "#{@original_item_due_id}_container-empty-d" if @old_due_empty } page.tag { container_id = "hidden_container-empty-d" if (@remaining_hidden_count == 0 && !@todo.hidden? && @todo_hidden_state_changed) || (@remaining_hidden_count == 0 && @todo.completed? && @original_item_was_hidden) diff --git a/app/views/todos/calendar.html.erb b/app/views/todos/calendar.html.erb index 8bf15ea3..04539567 100644 --- a/app/views/todos/calendar.html.erb +++ b/app/views/todos/calendar.html.erb @@ -1,54 +1,10 @@
-
-

<%= t('todos.calendar.due_today') %>

-
> - <%= t('todos.calendar.no_actions_due_today') %> -
-
- <%= render :partial => "todos/todo", :collection => @due_today %> -
-
- -
-

<%= t('todos.calendar.due_this_week') %>

-
> - <%= t('todos.no_actions_due_this_week') %> -
-
- <%= render :partial => "todos/todo", :collection => @due_this_week %> -
-
- -
-

<%= t('todos.calendar.due_next_week') %>

-
> - <%= t('todos.calendar.no_actions_due_next_week') %> -
-
- <%= render :partial => "todos/todo", :collection => @due_next_week %> -
-
- -
-

<%= t('todos.calendar.due_this_month', :month => l(Time.zone.now, :format => "%B")) %>

-
> - <%= t('todos.calendar.no_actions_due_this_month') %> -
-
- <%= render :partial => "todos/todo", :collection => @due_this_month %> -
-
- -
-

<%= t('todos.calendar.due_next_month_and_later', :month => l(Time.zone.now+1.month, :format => "%B")) %>

-
> - <%= t('todos.calendar.no_actions_due_after_this_month') %> -
-
- <%= render :partial => "todos/todo", :collection => @due_after_this_month %> -
-
+ <%= todos_calendar_container(:due_today, @due_today ) %> + <%= todos_calendar_container(:due_this_week, @due_this_week ) %> + <%= todos_calendar_container(:due_next_week, @due_next_week ) %> + <%= todos_calendar_container(:due_this_month, @due_this_month ) %> + <%= todos_calendar_container(:due_after_this_month, @due_after_this_month) %>
diff --git a/app/views/todos/toggle_check.js.erb b/app/views/todos/toggle_check.js.erb index 9d18ae46..60a7973a 100644 --- a/app/views/todos/toggle_check.js.erb +++ b/app/views/todos/toggle_check.js.erb @@ -1,4 +1,4 @@ -<% if !@saved -%> +<% unless @saved -%> TracksPages.page_notify('error', "<%= t('todos.error_toggle_complete') %>", 5); <% else -%> <% if @wants_redirect_after_complete && @todo.completed? -%> @@ -16,7 +16,7 @@ animation << "add_todo_to_context" unless source_view_is(:done) animation << "block_predecessors" end - animation << "update_empty_container" if source_view_is_one_of(:tag, :todo) + animation << "update_empty_container" if source_view_is_one_of(:tag, :todo, :deferred) animation << "regenerate_predecessor_family" else animation << "replace_todo" @@ -24,7 +24,6 @@ <%= render_animation(animation) %> TracksPages.set_page_badge(<%= @down_count %>); <% end -%> -<% end -%> function redirect_after_complete() { var path = "<%= @todo.project_id.nil? ? "/" : project_path(@todo.project) -%>"; @@ -206,4 +205,6 @@ function html_for_todo() { end -%> return "<%= js %>"; -} \ No newline at end of file +} + +<% end -%> \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 8c07c698..4b988fee 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -434,6 +434,11 @@ en: completed_today: No actions were completed today completed_rest_of_week: No actions were completed in the rest of this week completed_rest_of_month: No actions were completed in the rest of this month + due_today: No actions due today + due_this_week: No actions due this week + due_next_week: No actions due in next week + due_this_month: No actions due in rest of this month + due_after_this_month: No actions due after this month actions: completed: Completed actions home_completed: Completed actions @@ -566,15 +571,11 @@ en: error_starring: "Could not toggle the star of this todo '%{description}'" calendar: get_in_ical_format: Get this calendar in iCal format - due_next_week: Due next week - no_actions_due_next_week: No actions due in next week - due_this_week: Due in rest of this week due_today: Due today - no_actions_due_today: No actions due today - due_next_month_and_later: Due in %{month} and later - no_actions_due_after_this_month: No actions due after this month + due_this_week: Due in rest of this week + due_next_week: Due next week due_this_month: Due in rest of %{month} - no_actions_due_this_month: No actions due in rest of this month + due_after_this_month: Due in %{month} and later show_tomorrow: Show Tomorrow tagged_page_title: "TRACKS::Tagged with '%{tag_name}'" action_deferred: "The action '%{description}' was deferred" diff --git a/features/context_edit.feature b/features/context_edit.feature index 86878e7f..3700f3f2 100644 --- a/features/context_edit.feature +++ b/features/context_edit.feature @@ -72,7 +72,7 @@ Feature: Edit a context When I submit a new action with description "todo X" to project "test project" in the context "@personal" Then I should see the todo "todo X" - @javascript + @javascript Scenario: Moving the todo to the tickler will move todo to tickler container and update empty messages Given I have a context "test" with 1 todos When I go to the "test" context diff --git a/features/dependencies.feature b/features/dependencies.feature index 9d92b957..3ad1873d 100644 --- a/features/dependencies.feature +++ b/features/dependencies.feature @@ -23,7 +23,7 @@ Feature: dependencies When I expand the dependencies of "todo 2" Then I should see "todo 3" within the dependencies of "todo 2" - @javascript + @javascript Scenario: I can edit a todo to add the todo as a dependency to another Given I have a context called "@pc" And I have a project "dependencies" that has the following todos diff --git a/features/project_edit.feature b/features/project_edit.feature index 1420db21..f4570b0b 100644 --- a/features/project_edit.feature +++ b/features/project_edit.feature @@ -132,7 +132,7 @@ Feature: Edit a project And I should see empty message for completed todos of project And I should see empty message for todos of project - @javascript + @javascript Scenario: Moving the todo out of the tickler will move todo to active container and update empty messages Given I have a project "test" with 1 deferred todos When I go to the "test" project diff --git a/features/step_definitions/container_steps.rb b/features/step_definitions/container_steps.rb index 5c22ee9e..95eed0f0 100644 --- a/features/step_definitions/container_steps.rb +++ b/features/step_definitions/container_steps.rb @@ -153,7 +153,7 @@ Then /^I should see "([^"]*)" in the due next month container$/ do |todo_descrip todo = @current_user.todos.where(:description => todo_description).first todo.should_not be_nil - within "div#due_after_this_month" do + within "div#due_after_this_month_container" do page.should have_css("div#line_todo_#{todo.id}") end end