mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 11:10:12 +01:00
fix failing calendar scenarios
This commit is contained in:
parent
78a7bfe8e4
commit
5f8f2eefa9
8 changed files with 44 additions and 74 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,54 +1,10 @@
|
|||
<div id="display_box">
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('todos.calendar.due_today') %></h2>
|
||||
<div id="empty_due_today" <%= raw "style=\"display:none\"" unless @due_today.empty? %>>
|
||||
<%= t('todos.calendar.no_actions_due_today') %>
|
||||
</div>
|
||||
<div id="due_today">
|
||||
<%= render :partial => "todos/todo", :collection => @due_today %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('todos.calendar.due_this_week') %></h2>
|
||||
<div id="empty_due_this_week" <%= raw "style=\"display:none\"" unless @due_this_week.empty? %>>
|
||||
<%= t('todos.no_actions_due_this_week') %>
|
||||
</div>
|
||||
<div id="due_this_week">
|
||||
<%= render :partial => "todos/todo", :collection => @due_this_week %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('todos.calendar.due_next_week') %></h2>
|
||||
<div id="empty_due_next_week" <%= raw "style=\"display:none\"" unless @due_next_week.empty? %>>
|
||||
<%= t('todos.calendar.no_actions_due_next_week') %>
|
||||
</div>
|
||||
<div id="due_next_week">
|
||||
<%= render :partial => "todos/todo", :collection => @due_next_week %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('todos.calendar.due_this_month', :month => l(Time.zone.now, :format => "%B")) %></h2>
|
||||
<div id="empty_due_this_month" <%= raw "style=\"display:none\"" unless @due_this_month.empty? %>>
|
||||
<%= t('todos.calendar.no_actions_due_this_month') %>
|
||||
</div>
|
||||
<div id="due_this_month">
|
||||
<%= render :partial => "todos/todo", :collection => @due_this_month %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<h2><%= t('todos.calendar.due_next_month_and_later', :month => l(Time.zone.now+1.month, :format => "%B")) %></h2>
|
||||
<div id="empty_due_after_this_month" <%= raw "style=\"display:none\"" unless @due_after_this_month.empty? %>>
|
||||
<%= t('todos.calendar.no_actions_due_after_this_month') %>
|
||||
</div>
|
||||
<div id="due_after_this_month">
|
||||
<%= render :partial => "todos/todo", :collection => @due_after_this_month %>
|
||||
</div>
|
||||
</div>
|
||||
<%= 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) %>
|
||||
|
||||
</div><!-- End of display_box -->
|
||||
<div class="input_box" id="input_box">
|
||||
|
|
|
|||
|
|
@ -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 %>";
|
||||
}
|
||||
}
|
||||
|
||||
<% end -%>
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue