diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index 657c0006..bfc0c96c 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -140,5 +140,36 @@ class ContextController < ApplicationController item.toggle!('done') render_partial 'show_items', item - end + end + + # Methods for changing the sort order of the contexts in the list + # + def move_up + line = Context.find(params[:id]) + line.move_higher + line.save + redirect_to(:controller => "context", :action => "list") + end + + def move_down + line = Context.find(params[:id]) + line.move_lower + line.save + redirect_to(:controller => "context", :action => "list") + end + + def move_top + line = Context.find(params[:id]) + line.move_to_top + line.save + redirect_to(:controller => "context", :action => "list") + end + + def move_bottom + line = Context.find(params[:id]) + line.move_to_bottom + line.save + redirect_to(:controller => "context", :action => "list" ) + end + end diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index a0bec9f6..f2e44e16 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -140,6 +140,36 @@ 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 + line = Project.find(params[:id]) + line.move_higher + line.save + redirect_to(:controller => "project", :action => "list") + end + + def move_down + line = Project.find(params[:id]) + line.move_lower + line.save + redirect_to(:controller => "project", :action => "list") + end + + def move_top + line = Project.find(params[:id]) + line.move_to_top + line.save + redirect_to(:controller => "project", :action => "list") + end + + def move_bottom + line = Project.find(params[:id]) + line.move_to_bottom + line.save + redirect_to(:controller => "project", :action => "list" ) + end end diff --git a/tracks/app/views/context/_context_listing.rhtml b/tracks/app/views/context/_context_listing.rhtml index ee3dc80e..b8440af7 100644 --- a/tracks/app/views/context/_context_listing.rhtml +++ b/tracks/app/views/context/_context_listing.rhtml @@ -8,7 +8,10 @@
<% end %>
- <%= context.position.to_s %> + <%= link_to( "⇞", {:action => "move_top", :id => context.id}, :title => "Move to top" ) %> + <%= link_to( "↑", {:action => "move_up", :id => context.id}, :title => "Move up" ) %> + <%= link_to( "↓", {:action => "move_down", :id => context.id}, :title => "Move down" ) %> + <%= link_to( "⇟", {:action => "move_bottom", :id => context.id}, :title => "Move to bottom" ) %>
<%= link_to( "#{context.name}", :action => "show", :name => urlize(context.name) ) %><%= " (" + Todo.count( "context_id=#{context.id} AND done=0" ).to_s + " actions)" %> diff --git a/tracks/app/views/project/_project_listing.rhtml b/tracks/app/views/project/_project_listing.rhtml index 68678bc4..92a5c6e7 100644 --- a/tracks/app/views/project/_project_listing.rhtml +++ b/tracks/app/views/project/_project_listing.rhtml @@ -8,7 +8,10 @@
<% end %>
- <%= project.position.to_s %> + <%= link_to( "⇞", {:action => "move_top", :id => project.id}, :title => "Move to top" ) %> + <%= link_to( "↑", {:action => "move_up", :id => project.id}, :title => "Move up" ) %> + <%= link_to( "↓", {:action => "move_down", :id => project.id}, :title => "Move down" ) %> + <%= link_to( "⇟", {:action => "move_bottom", :id => project.id}, :title => "Move to bottom" ) %>
<%= link_to( "#{project.name}", :action => "show", :name => urlize(project.name) ) %><%= " (" + Todo.count( "project_id=#{project.id} AND done=0" ).to_s + " actions)" %> diff --git a/tracks/doc/CHANGENOTES.txt b/tracks/doc/CHANGENOTES.txt index f909984d..e51e0d5d 100644 --- a/tracks/doc/CHANGENOTES.txt +++ b/tracks/doc/CHANGENOTES.txt @@ -28,6 +28,10 @@ Project wiki: 13. Can now uncheck actions from the completed actions list, so that they dynamically appear back in the uncompleted actions area. 14. A tiny improvement: the toggling of the individual notes now uses Element.toggle from prototype.js, so it doesn't have to be an onLoad property of the body tag. This means that you don't get the notes flashing before they are hidden when you load or reload a page. 15. All the adding, updating, deleting and marking actions done is performed using Ajax, so happens without needing to refresh the page. +16. There's a new setting in settings.yml (staleness_starts) which defines the number of days before which actions get marked as stale. Let's say you set it to 7 days. Actions created between 7 and 14 days ago get marked pale yellow, those created between 14 and 28 days ago (staleness_starts * 2) get +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. ## Version 1.02 diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index b134bd2c..da5d4002 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -315,8 +315,8 @@ input { } /* Positioning the 'cells' in the list */ -.position {text-align: left; width: 5%; float: left;} -.data {text-align: left; width: 65%; float: left;} +.position {text-align: left; width: 10%; float: left; font-size: 1.1em;} +.data {text-align: left; width: 60%; float: left;} .buttons {text-align: right; width: 25%; margin-left: 75%;} table.list {