From 5fc3636f72f8267ba176503b268c53abcc53623c Mon Sep 17 00:00:00 2001 From: bsag Date: Mon, 28 Mar 2005 15:18:22 +0000 Subject: [PATCH] [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. The toggled state is stored in a cookie. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@50 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/views/layouts/standard.rhtml | 2 +- tracks/app/views/todo/list.rhtml | 14 +++-- tracks/doc/CHANGENOTES.txt | 1 + tracks/public/images/collapse.png | Bin 0 -> 242 bytes tracks/public/images/expand.png | Bin 0 -> 286 bytes tracks/public/javascripts/toggle_notes.js | 70 ++++++++++++++++++++++ 6 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 tracks/public/images/collapse.png create mode 100644 tracks/public/images/expand.png 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 0000000000000000000000000000000000000000..cc60e28d3e1dbe559b79a7aaa794ae23d74c0cf6 GIT binary patch literal 242 zcmeAS@N?(olHy`uVBq!ia0vp^0zfRp!3HFQtmCqPlun6jM2T}zYGO%dex5=|W^O7& zcxsA*p_zhjVv&N8fq|)lfw`5bsg<#@g06w7fkDv?NMQuIyKt1$ZoYf37kP z1PXB$ctjR6FvuMOVaB`*rFK9;mUKs7M+SzC{oH>NS%G{{PZ!6Kid)GE60AKZ=1iM5 z?SG5Ol`B^kyhwBm4~UKJ4KB{k)^3v!UK+RH27_2mQ%_HiMAHBN|JCm?#B^moVtv)l gxNU_Ls|g!J=MuhUOL90nfQB-7y85}Sb4q9e08mCr8vp 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 //