fix count in navbar and fix tickler

This commit is contained in:
Reinier Balt 2013-08-24 22:11:52 +02:00
parent 031f9fe967
commit 37f8acb214
6 changed files with 51 additions and 55 deletions

View file

@ -551,7 +551,7 @@ class TodosController < ApplicationController
@page_title = t('todos.deferred_tasks_title')
@contexts_to_show = @contexts = current_user.contexts
@projects_to_show = @projects = current_user.projects
@projects_to_show = @projects = current_user.projects.active + current_user.projects.hidden
includes = params[:format]=='xml' ? [:context, :project] : Todo::DEFAULT_INCLUDES

View file

@ -29,7 +29,7 @@
</head>
<body class="<%= controller.controller_name %>">
<% cache [:navbar] do -%>
<% cache [:navbar, @count||@badge_count] do -%>
<%= render partial: "shared/navbar" %>
<% end -%>

View file

@ -1,11 +1,9 @@
<div id="<%=div_id%>" class="todo_items toggle_target">
<% cache [settings[:container_name], settings[:show_empty_message]] do %>
<%= render partial: "todos/container_empty_message", locals: {
container_id: settings[:container_id],
container_name: settings[:container_name],
show_empty_message: settings[:show_empty_message]} -%>
<% end -%>
<%= render(:partial => "todos/todo", :collection => collection, :locals => settings) %>
</div>

View file

@ -1,41 +1,37 @@
<%
suppress_context ||= false
suppress_project ||= false
cache [todo, current_user.date.strftime("%Y%m%d"), @source_view, current_user.prefs.verbose_action_descriptors] do
-%>
<div id="<%= dom_id(todo) %>" class="todo-item"
data-info="<%= render partial: "todos/todo_info", locals: {todo: todo} %>">
<div class="row">
<div class="span8">
<span class="todo-item-icons">
<i class="<%= todo.completed? ? "icon-check-sign" : "icon-check-empty"%>"></i>
<i class="<%= todo.starred? ? "icon-star" : "icon-star-empty"%>"></i>
<% cache [todo, current_user.date.strftime("%Y%m%d"), @source_view, current_user.prefs.verbose_action_descriptors] do -%>
<div id="<%= dom_id(todo) %>" class="todo-item"
data-info="<%= render partial: "todos/todo_info", locals: {todo: todo} %>">
<div class="row">
<div class="span8">
<span class="todo-item-icons">
<i class="<%= todo.completed? ? "icon-check-sign" : "icon-check-empty"%>"></i>
<i class="<%= todo.starred? ? "icon-star" : "icon-star-empty"%>"></i>
</span>
<span class="todo-item-description-container">
<span class="todo-description <%= "tracks-todo-overdue" if todo.overdue?%>"><%= todo.description %></span>
<span class="todo-description-icons">
<%= content_tag(:i, {class: "icon-refresh"}){} if todo.from_recurring_todo? -%>
<%= deferred_due_date(todo) -%>
<%= content_tag(:i, {class: "icon-sitemap"}){} if todo.has_pending_successors -%>
<%= content_tag(:i, {class: "icon-book", "data-note-id" => dom_id(todo, 'notes')}){} unless todo.notes.blank? %>
</span>
<span class="todo-item-description-container">
<span class="todo-description <%= "tracks-todo-overdue" if todo.overdue?%>"><%= todo.description %></span>
<span class="todo-description-icons">
<%= content_tag(:i, {class: "icon-refresh"}){} if todo.from_recurring_todo? -%>
<%= deferred_due_date(todo) -%>
<%= content_tag(:i, {class: "icon-sitemap"}){} if todo.has_pending_successors -%>
<%= content_tag(:i, {class: "icon-book", "data-note-id" => dom_id(todo, 'notes')}){} unless todo.notes.blank? %>
</span>
</span>
<span class="todo-item-detail hide"><br/>
<p class="todo-project-and-context"><small>
project: <span class="todo-project-name"><%= todo.project.name.blank? ? "none" : link_to(todo.project.name, todo.project) %></span><br/>
context: <span class="todo-context-name"><%= todo.context.name.blank? ? "none" : link_to(todo.context.name, todo.context) %></span>
</small></p>
</span>
</div>
<div class="span4 pull-right hidden-phone tracks-todo-badges">
<%= date_span(todo) -%>
<%= tag_list(todo) %>
</div>
</span>
<span class="todo-item-detail hide"><br/>
<p class="todo-project-and-context"><small>
project: <span class="todo-project-name"><%= todo.project.name.blank? ? "none" : link_to(todo.project.name, todo.project) %></span><br/>
context: <span class="todo-context-name"><%= todo.context.name.blank? ? "none" : link_to(todo.context.name, todo.context) %></span>
</small></p>
</span>
</div>
<div class="row">
<div id="<%=dom_id(todo, 'notes')%>" class="todo-notes hide">
<%= todo_notes(todo) %>
</div>
<div class="span4 pull-right hidden-phone tracks-todo-badges">
<%= date_span(todo) -%>
<%= tag_list(todo) %>
</div>
</div>
<div class="row">
<div id="<%=dom_id(todo, 'notes')%>" class="todo-notes hide">
<%= todo_notes(todo) %>
</div>
</div>
</div>
<% end -%>

View file

@ -17,6 +17,6 @@
-%>
<% # use the first completed todo (which is the last one to be completed) as cache invariant
cache [@done.first, "home_completed"] do %>
cache [@done.first, "home_completed"] do -%>
<%= show_done_todos(@done, {:parent_container_type => @group_view_by, :collapsible => true}) unless @done.nil? %>
<% end %>
<% end -%>

View file

@ -1,15 +1,17 @@
<div id="display_box">
<%# Template Dependency: todos/collection -%>
<%# Template Dependency: contexts/context -%>
<%# Template Dependency: projects/project -%>
<% cache [@not_done_todos.empty?, "tickler_not_done"] do -%>
<%= render partial: "empty_message_container", locals: {:show => @not_done_todos.empty?, :container_name => "not_done"} %>
<% end -%>
<%= empty_message_holder("deferred_pending", @not_done_todos.empty?) %>
<%= show_grouped_todos %>
<%= show_grouped_todos %>
<% if @group_view_by == 'project' -%>
<%= show_todos_without_project(@todos_without_project) -%>
<% end -%>
</div>
<div id="input_box">
<%= render :partial => "shared/add_new_item_form" %>
<%= render :file => "sidebar/sidebar" %>
</div>
<% if @group_view_by == 'project'
# use the last updated todo without a project as cache invariant.
# Changing an exisiting todo or adding a new one will result in a new cache key
cache [@last_updated_todo_without_project, "todos_without_project"] do -%>
<%= show_todos_without_project(@todos_without_project) %>
<% end
end
-%>