From 8a085152279a61a48023705b6dad4cf66e8c9b45 Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 29 May 2005 10:31:49 +0000 Subject: [PATCH] You can mark projects as completed (by editing the project on /projects). In the 'sidebar' active and completed projects are shown separately, but you can still view the completed project. Fixes #5. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@91 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/project_controller.rb | 2 +- tracks/app/views/context/show.rhtml | 14 +++++++ tracks/app/views/project/_project_form.rhtml | 2 + .../app/views/project/_project_listing.rhtml | 8 +++- tracks/app/views/project/_show_items.rhtml | 2 +- tracks/app/views/project/show.rhtml | 37 +++++++++++++++---- tracks/app/views/todo/list.rhtml | 32 +++++++++++----- tracks/doc/CHANGENOTES.txt | 2 +- tracks/public/stylesheets/standard.css | 8 ++++ 9 files changed, 87 insertions(+), 20 deletions(-) diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index f2e44e16..c4dc99fd 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -140,7 +140,7 @@ class ProjectController < ApplicationController item.toggle!('done') render_partial 'show_items', item end - + # Methods for changing the sort order of the projects in the list # def move_up diff --git a/tracks/app/views/context/show.rhtml b/tracks/app/views/context/show.rhtml index ec524fac..3efc108b 100644 --- a/tracks/app/views/context/show.rhtml +++ b/tracks/app/views/context/show.rhtml @@ -76,6 +76,20 @@
  • <%= link_to( other_context.name, { :controller => "context", :action => "show", :name => urlize(other_context.name) } ) + " (" + Todo.count( "project_id=#{other_context.id} AND done=0" ).to_s + " actions)" %>
  • <% end %> + +

    Active Projects:

    + + +

    Completed Projects:

    + <% if @flash["confirmation"] %>
    <%= @flash["confirmation"] %>
    <% end %> diff --git a/tracks/app/views/project/_project_form.rhtml b/tracks/app/views/project/_project_form.rhtml index 0f284077..18822e59 100644 --- a/tracks/app/views/project/_project_form.rhtml +++ b/tracks/app/views/project/_project_form.rhtml @@ -8,5 +8,7 @@
    <%= text_field 'project', 'name', :class => 'project-name' %> + +<%= check_box 'project', 'done', :class => 'project-done' %>
    <% @project = nil %> \ No newline at end of file diff --git a/tracks/app/views/project/_project_listing.rhtml b/tracks/app/views/project/_project_listing.rhtml index 92a5c6e7..8da7488a 100644 --- a/tracks/app/views/project/_project_listing.rhtml +++ b/tracks/app/views/project/_project_listing.rhtml @@ -17,7 +17,13 @@ <%= link_to( "#{project.name}", :action => "show", :name => urlize(project.name) ) %><%= " (" + Todo.count( "project_id=#{project.id} AND done=0" ).to_s + " actions)" %>
    - <%= link_to_function(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focus_first('form-project-#{project.id}');" ) + " " + + <% if project.done == 1 -%> + + <% else -%> + + <% end -%> + + <%= link_to_function(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focus_first('form-project-#{project.id}');" ) + " " + link_to_remote( image_tag("delete", :title =>"Delete this project"), :update => "project-#{project.id}-container", :loading => "new Effect.Squish('project-#{project.id}-container')", diff --git a/tracks/app/views/project/_show_items.rhtml b/tracks/app/views/project/_show_items.rhtml index fac643e2..a60268ca 100644 --- a/tracks/app/views/project/_show_items.rhtml +++ b/tracks/app/views/project/_show_items.rhtml @@ -6,7 +6,7 @@ :update => "completed", :position => "top", :loading => "Form.disable('checkbox-notdone-#{item.id}');", - :complete => "new Effect.Squish('project-item-#{item.id}-container', true);" + :complete => "new Effect.Squish('item-#{item.id}-container', true);" ) %>
    diff --git a/tracks/app/views/project/show.rhtml b/tracks/app/views/project/show.rhtml index 34407798..d91bcc56 100644 --- a/tracks/app/views/project/show.rhtml +++ b/tracks/app/views/project/show.rhtml @@ -4,13 +4,15 @@

    <%= @project.name %>

    - <% if @not_done.empty? %> + <% if @project.done == 1 -%> +

    This project has been completed

    + <% elsif @not_done.empty? -%>

    There are no next actions yet in this project

    - <% else %> - <% for item in @not_done %> + <% else -%> + <% for item in @not_done -%> <%= render_partial "show_items", item %> - <% end %> - <% end %> + <% end -%> + <% end -%>
    @@ -64,8 +66,29 @@

    Active Projects:

    + +

    Completed Projects:

    + + +

    Active Contexts:

    + + +

    Hidden Contexts:

    +
    diff --git a/tracks/app/views/todo/list.rhtml b/tracks/app/views/todo/list.rhtml index e21308a0..49e8ef9e 100644 --- a/tracks/app/views/todo/list.rhtml +++ b/tracks/app/views/todo/list.rhtml @@ -77,17 +77,31 @@

    Active Projects:

    - + +

    Completed Projects:

    + + +

    Active Contexts:

    + +

    Hidden Contexts:

    - + diff --git a/tracks/doc/CHANGENOTES.txt b/tracks/doc/CHANGENOTES.txt index e51e0d5d..f7fdd956 100644 --- a/tracks/doc/CHANGENOTES.txt +++ b/tracks/doc/CHANGENOTES.txt @@ -17,7 +17,6 @@ Project wiki: 2. Removed the section in config/environment.rb which requires Redcloth. This was causing errors because Rails now requires Redcloth itself. This means that you now need to have Redcloth installed as a gem (gem install redcloth) (thanks, Jim). 3. Fixed SQLite dump format in db/tracks_1.0.2_sqlite.sql (thanks, Jim) 4. The new item forms on all pages now use a mini calendar which pops up when you click the due date field. Calendar is the GPL one from dynarch.com -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 Lolindrath] 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. 7. [Contributed by Jim Ray] Jim added a host of fixes and bits of cleaning up, including a position column for contexts and projects to allow custom sorting, and changes to the links for pages to make them more human-readable. 8. I added a pop-up calendar to set the due date. This is entirely lifted from Michele's excellent tutorial on pxl8.com . It works well, but I need to make sure it doesn't break in postgresql or sqlite. @@ -32,6 +31,7 @@ Project wiki: marked darker yellow, and those created more than 28 days ago (staleness_starts * 3) are fluorescent yellow! 17. Contexts and projects can now be sorted in any order you like. Arrow buttons on the /contexts and /projects pages let you move an item to the top, up, down or to the bottom. For contexts, this affects the order in which they sort on the home page. +18. You can mark projects as completed (by editing the project on /projects). In the 'sidebar' active and completed projects are shown separately, but you can still view the completed project. ## Version 1.02 diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index da5d4002..ce027545 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -245,6 +245,14 @@ h2 a:hover { padding: 1px; font-size: 10px; } + +.info { + color: #fff; + background: #CCC; + border: 1px solid #999; + padding: 5px; + text-align: center; + } /* Backgrounds marking out 'staleness' of a task based on age of creation date The colour of the background gets progressively yellower with age */