mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-27 12:28:48 +01:00
implement switching grouping
This commit is contained in:
parent
dbe8060bec
commit
d139693632
11 changed files with 107 additions and 56 deletions
|
|
@ -23,9 +23,10 @@
|
|||
// require jquery-ui-1.10.0.custom.min
|
||||
// require jquery.ui.touch-punch.min
|
||||
// require jquery.blockUI
|
||||
// require jquery.cookie
|
||||
// require jquery.form
|
||||
// require jquery.jeditable.mini
|
||||
// require jquery.simulate.drag-sortable
|
||||
// require jquery.truncator
|
||||
|
||||
//= require jquery.cookie
|
||||
//= require swf_fu
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ $ ->
|
|||
Mousetrap.bind 'g s', -> TracksApp.go_starred()
|
||||
|
||||
# VIEW
|
||||
Mousetrap.bind 'v p', -> alert("group by project")
|
||||
Mousetrap.bind 'v c', -> alert("group by context")
|
||||
Mousetrap.bind 'v p', -> TracksApp.group_view_by_project()
|
||||
Mousetrap.bind 'v c', -> TracksApp.group_view_by_context()
|
||||
|
||||
# Item Selection
|
||||
Mousetrap.bind 'j', -> TracksApp.selectNext()
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ TracksApp =
|
|||
go_projects: -> TracksApp.goto_page "/projects"
|
||||
go_starred: -> TracksApp.goto_page "/tag/starred"
|
||||
|
||||
# TODO: refactor to work for contexts and projects and tags
|
||||
go_project: ->
|
||||
$("input#tracks-goto-project").val("")
|
||||
$('div#tracks-go-project-dialog').on 'shown', -> $("input#tracks-goto-project").focus()
|
||||
|
|
@ -68,29 +69,42 @@ TracksApp =
|
|||
unless TracksApp.selectPrevNext(false)?
|
||||
TracksApp.selectTodo($("div.todo-item").first())
|
||||
|
||||
show_note: (node) ->
|
||||
notes_id = node.attr("data-note-id")
|
||||
notes_div = $("div#" + notes_id )
|
||||
notes_div.toggleClass("hide")
|
||||
todo_item = $(this).parent().parent().parent().parent().parent()
|
||||
TracksApp.selectTodo(todo_item)
|
||||
|
||||
refresh_page: ->
|
||||
location.reload(true)
|
||||
|
||||
group_view_by: (state) ->
|
||||
$.cookie('group_view_by', state)
|
||||
|
||||
group_view_by_context: ->
|
||||
TracksApp.group_view_by('context')
|
||||
TracksApp.refresh_page()
|
||||
|
||||
group_view_by_project: ->
|
||||
TracksApp.group_view_by('project')
|
||||
TracksApp.refresh_page()
|
||||
|
||||
|
||||
# Make TracksApp globally accessible. From http://stackoverflow.com/questions/4214731/coffeescript-global-variables
|
||||
root = exports ? this
|
||||
root.TracksApp = TracksApp
|
||||
|
||||
$ ->
|
||||
$("a#menu-keyboard-shotcuts").click -> $('div#tracks-shortcuts-dialog').modal()
|
||||
|
||||
$("a.button-add-todo").click -> TracksApp.add_todo()
|
||||
$("a.button-home").click -> TracksApp.go_home()
|
||||
$("a.button-goto").click -> TracksApp.go_menu()
|
||||
|
||||
$("i.icon-book").click ->
|
||||
notes_id = $( this ).attr("data-note-id")
|
||||
notes_div = $("div#" + notes_id )
|
||||
notes_div.toggleClass("hide")
|
||||
todo_item = $(this).parent().parent().parent().parent()
|
||||
TracksApp.selectTodo(todo_item)
|
||||
|
||||
$("span.todo-item-description-container").click ->
|
||||
TracksApp.selectTodo( $(this).parent().parent().parent() )
|
||||
$("a#menu-keyboard-shotcuts").click -> $('div#tracks-shortcuts-dialog').modal()
|
||||
$("a.button-add-todo").click -> TracksApp.add_todo()
|
||||
$("a.button-home").click -> TracksApp.go_home()
|
||||
$("a.button-goto").click -> TracksApp.go_menu()
|
||||
$("i.icon-book").click -> TracksApp.show_note( $(this) )
|
||||
$("span.todo-item-description-container").click -> TracksApp.selectTodo( $(this).parent().parent().parent() )
|
||||
|
||||
$('.ajax-typeahead').typeahead
|
||||
minLength: 3,
|
||||
minLength: 2,
|
||||
source: (query, process) ->
|
||||
typeaheadURL = $(this)[0].$element[0].dataset.link
|
||||
return $.ajax
|
||||
|
|
@ -101,4 +115,4 @@ $ ->
|
|||
success: (json) ->
|
||||
$("input#tracks-json-result").val(json)
|
||||
map = $.map json, (data, item) -> data.value
|
||||
return process(map)
|
||||
return process(map)
|
||||
|
|
@ -57,13 +57,12 @@ div.todo-item {
|
|||
border: 3px solid #EEE;
|
||||
border-width: 0px 0px 1px 0px;
|
||||
padding: 0px 3px 0px 3px;
|
||||
|
||||
min-height: none;
|
||||
line-height: none;
|
||||
|
||||
[class*="span"] {
|
||||
min-height: 0px;
|
||||
}
|
||||
|
||||
div.row {
|
||||
margin-left: 0px;
|
||||
}
|
||||
|
|
@ -74,19 +73,26 @@ div.todo-item {
|
|||
margin-right: 10px;
|
||||
color: #666;
|
||||
}
|
||||
i.icon-star-empty, i.icon-play-sign, i.icon-book, i.icon-refresh {
|
||||
span.todo-description-icons {
|
||||
color: #BBB; /* light gray */
|
||||
cursor: pointer;
|
||||
}
|
||||
i.icon-star {
|
||||
color: #F89406; /* orange */
|
||||
span.todo-item-icons {
|
||||
color: #BBB; /* light gray */
|
||||
display: block;
|
||||
margin-right: 5px;
|
||||
float:left;
|
||||
cursor: pointer;
|
||||
i.icon-check-empty {
|
||||
color: #333;
|
||||
}
|
||||
i.icon-star {
|
||||
color: #F89406; /* orange */
|
||||
}
|
||||
}
|
||||
span.todo-description {
|
||||
margin-right: 10px;
|
||||
}
|
||||
span.todo-item-icons {
|
||||
display: block;
|
||||
margin-right: 10px;
|
||||
float:left;
|
||||
cursor: pointer;
|
||||
}
|
||||
span.todo-item-description-container {
|
||||
display: inline-block;
|
||||
|
|
@ -126,6 +132,8 @@ div.selected-item {
|
|||
|
||||
span.tags {
|
||||
.label {
|
||||
margin-right: 1px;
|
||||
background-color: #BBB;
|
||||
a:hover, a:focus {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
|
@ -134,8 +142,6 @@ span.tags {
|
|||
color: #FFF;
|
||||
font-weight: normal;
|
||||
}
|
||||
margin-right: 1px;
|
||||
background-color: #BBB;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,6 +155,12 @@ div.todos-container {
|
|||
a {
|
||||
color: #444;
|
||||
}
|
||||
span.add-note-link {
|
||||
a {
|
||||
color: #BBB;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -164,6 +176,10 @@ div#tracks-go-project-dialog {
|
|||
}
|
||||
}
|
||||
|
||||
div.paginate_header {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Generic */
|
||||
|
||||
div.hide_me {
|
||||
|
|
|
|||
|
|
@ -59,4 +59,4 @@
|
|||
<%= javascript_include_tag "application" %>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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>
|
||||
|
|
@ -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">
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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 %>
|
||||
Loading…
Add table
Add a link
Reference in a new issue