diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index c7a1044e..b54e1141 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -19,7 +19,7 @@ var moty = ["January","February","March","April","May","June","July","August","S - +

<% if @count %> diff --git a/tracks/app/views/todo/list.rhtml b/tracks/app/views/todo/list.rhtml index bec6e6ad..75c573aa 100644 --- a/tracks/app/views/todo/list.rhtml +++ b/tracks/app/views/todo/list.rhtml @@ -1,12 +1,16 @@
-<% for @shown_place in @shown_places %> - <% @not_done = Todo.find_all("done=0 AND context_id=#{@shown_place.id}", "created ASC") %> - <% if !@not_done.empty? %> -
-

<%= link_to( "#{@shown_place.name.capitalize}", :controller => "context", :action => "show", :name => urlize(@shown_place.name) ) %>

+ <% for @shown_place in @shown_places %> + <% @not_done = Todo.find_all("done=0 AND context_id=#{@shown_place.id}", "created ASC") %> + <% if !@not_done.empty? %> +
+

+ + <%= link_to( "#{@shown_place.name.capitalize}", :controller => "context", :action => "show", :name => urlize(@shown_place.name) ) %>

+
<%= render_collection_of_partials "not_done", @not_done %>
+
<% end %> <% end %> diff --git a/tracks/doc/CHANGENOTES.txt b/tracks/doc/CHANGENOTES.txt index 6f734d5e..05015708 100644 --- a/tracks/doc/CHANGENOTES.txt +++ b/tracks/doc/CHANGENOTES.txt @@ -17,6 +17,7 @@ Project wiki: 3. Fixed SQLite dump format in db/tracks_1.0.2_sqlite.sql (thanks, Jim) 4. Added a mini-calendar to the todo/list page. Needs some tidying up, but it provides a quick way to look up a date a few months ahead. Note that it doesn't insert the date: it's just for viewing. I modified the calendar a little bit from here: 5. Added some XMLHTTPRequest calls to speed up checking off an item as done. It grabs the checked item and appends it immediately to a 'holding' section (where you can uncheck it again if it was a mistake, or add a closing note). When you next refresh the page, it will be added to the 'Last 5 completed items' section. +6. [Contributed by Andrew Williams] Toggling of contexts in /todo/list to collapse or expand their display via a small '+' or '-' graphic. This is independent of the shown/hidden setting for contexts, and is ideal for just hiding things on the fly to focus your view. ## Version 1.02 diff --git a/tracks/public/images/collapse.png b/tracks/public/images/collapse.png new file mode 100644 index 00000000..cc60e28d Binary files /dev/null and b/tracks/public/images/collapse.png differ diff --git a/tracks/public/images/expand.png b/tracks/public/images/expand.png new file mode 100644 index 00000000..a526384d Binary files /dev/null and b/tracks/public/images/expand.png differ diff --git a/tracks/public/javascripts/toggle_notes.js b/tracks/public/javascripts/toggle_notes.js index 8633efe6..e4077578 100644 --- a/tracks/public/javascripts/toggle_notes.js +++ b/tracks/public/javascripts/toggle_notes.js @@ -9,6 +9,76 @@ function toggle(idname) { document.getElementById(idname).style.display = (document.getElementById(idname).style.display == 'none') ? 'block' : 'none'; } +// Contributed by Andrew Williams +function toggleAllImages() +{ + var cookies = document.cookie.split(';'); + + for(var i = 0; i < cookies.length; i++) + { + var str = cookies[i].split('=')[0]; + + if(str.indexOf('toggle_context_') != -1) + { + var id = str.split('_')[2]; + if(getCookie(str) == 'collapsed') + { + toggle('c'+id); + toggleImage('toggle_context_'+id); + } + } + } +} + +function toggle(idname) +{ +document.getElementById(idname).style.display = (document.getElementById(idname).style.display == 'none') ? 'block' : 'none'; +} + +function toggleImage(idname) +{ + if(document.images) + { + if(document[idname].src.indexOf('collapse.png') != -1) + { + document[idname].src = '/images/expand.png'; + SetCookie(idname, "collapsed"); + } + else + { + document[idname].src = '/images/collapse.png'; + SetCookie(idname, "expanded"); + } + } +} + +function SetCookie (name, value) { + var argv = SetCookie.arguments; + var argc = SetCookie.arguments.length; + var expires = (argc > 2) ? argv[2] : null; + var path = (argc > 3) ? argv[3] : null; + var domain = (argc > 4) ? argv[4] : null; + var secure = (argc > 5) ? argv[5] : false; + document.cookie = name + "=" + escape (value) + + ((expires == null) ? "" : ("; expires=" + + expires.toGMTString())) + + ((path == null) ? "" : ("; path=" + path)) + + ((domain == null) ? "" : ("; domain=" + domain)) + + ((secure == true) ? "; secure" : ""); +} + +var bikky = document.cookie; + + function getCookie(name) { // use: getCookie("name"); + var index = bikky.indexOf(name + "="); + if (index == -1) return null; + index = bikky.indexOf("=", index) + 1; // first character + var endstr = bikky.indexOf(";", index); + if (endstr == -1) endstr = bikky.length; // last character + return unescape(bikky.substring(index, endstr)); + } + + // // XMLHTTPRequest code from David Goodlad //