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. Fixes #46.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@90 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-05-29 09:32:02 +00:00
parent c6ec129570
commit ed5d72e9e1
6 changed files with 76 additions and 5 deletions

View file

@ -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