implement switching grouping

This commit is contained in:
Reinier Balt 2013-07-29 12:23:52 +02:00
parent dbe8060bec
commit d139693632
11 changed files with 107 additions and 56 deletions

View file

@ -59,4 +59,4 @@
<%= javascript_include_tag "application" %>
</body>
</html>
</html>

View file

@ -6,7 +6,7 @@
<div class="modal-body">
<form class="form-search">
<input type="text" id="tracks-goto-project" class="input-medium search-query ajax-typeahead" placeholder="Type (part of) project name"
data-link="/projects.autocomplete">
data-link="/projects.autocomplete" autocomplete="off">
<input type="hidden" id="tracks-json-result">
</form>
</div>
@ -14,4 +14,4 @@
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Go to project</button>
</div>
</div>`
</div>

View file

@ -14,4 +14,4 @@
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>`
</div>

View file

@ -4,17 +4,24 @@
<h3 id="myModalLabel">Keyboard Shortcuts</h3>
</div>
<div class="modal-body">
<p>You can use the following shortcuts on every page:</p>
<ul>
<li>?: Shows this help page</li>
<li>a: add action</li>
<li>g then h: go to the home page</li>
<li>g then c: go to a specific context</li>
<li>g then C: go to the contexts page</li>
<li>g then p: go to a specific project</li>
<li>g then P: go to the projects page</li>
<li>v then p: group the actions on the page by project</li>
<li>v then c: group the actions on the page by context</li>
<li><span class="badge">?</span>: Shows this help page</li>
<li><span class="badge">a</span>: add action</li>
</ul>
<p>Navigation:</p>
<ul>
<li><span class="badge">j</span> or <span class="badge">k</span>: go to previous or next item</li>
<li><span class="badge">G</span>: show list of project and contexts</li>
<li><span class="badge">g</span> then <span class="badge">h</span>: go to the home page</li>
<li><span class="badge">g</span> then <span class="badge">c</span>: go to a specific context</li>
<li><span class="badge">g</span> then <span class="badge">C</span>: go to the contexts page</li>
<li><span class="badge">g</span> then <span class="badge">p</span>: go to a specific project</li>
<li><span class="badge">g</span> then <span class="badge">P</span>: go to the projects page</li>
</ul>
<p>Grouping of actions:</p>
<ul>
<li><span class="badge">v</span> then <span class="badge">p</span>: group the actions on the page by project</li>
<li><span class="badge">v</span> then <span class="badge">c</span>: group the actions on the page by context</li>
</ul>
</div>
<div class="modal-footer">

View file

@ -12,10 +12,12 @@
</span>
<span class="todo-item-description-container">
<span class="todo-description"><%= todo.description %></span>
<%= 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 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="small todo-project-and-context"><small>

View file

@ -6,6 +6,11 @@
<i class="icon-calendar"></i> Defer <span class="caret"></span>
</a>
<ul class="dropdown-menu">
<li><a>Tomorrow</a></li>
<li><a>Next weekend</a></li>
<li><a>Next week</a></li>
<li><a>Next month</a></li>
<li class="divider"></li>
<li><a>1 day</a></li>
<li><a>2 days</a></li>
<li><a>3 days</a></li>

View file

@ -1,16 +1,22 @@
<%# Template Dependency: todos/collection -%>
<%# Template Dependency: contexts/context -%>
<%# Template Dependency: projects/project -%>
<% cache ["not_done", @not_done_todos.empty?] do -%>
<% cache [@not_done_todos.empty?, "home_not_done"] do -%>
<%= render partial: "empty_message_container", locals: {:show => @not_done_todos.empty?, :container_name => "not_done"} %>
<% end -%>
<%= show_grouped_todos %>
<% if @group_view_by == 'project' -%>
<%= show_todos_without_project(@todos_without_project) -%>
<% end -%>
<% 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
-%>
<% cache [@done.first, "home_completed"] do %>
<%= show_done_todos(@done, {:parent_container_type => @group_view_by, :collapsible => true}) unless @done.nil? %>
<% # use the first completed todo (which is the last one to be completed) as cache invariant
cache [@done.first, "home_completed"] do %>
<%= show_done_todos(@done, {:parent_container_type => @group_view_by, :collapsible => true}) unless @done.nil? %>
<% end %>