mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-18 15:15:27 +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 -%>
|
||||
Loading…
Add table
Add a link
Reference in a new issue