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

View file

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

View file

@ -8,7 +8,10 @@
<div id="context-<%= context.id %>" class="odd_row" style="display:'';">
<% end %>
<div class="position">
<%= context.position.to_s %>
<%= link_to( "&#8670;", {:action => "move_top", :id => context.id}, :title => "Move to top" ) %>
<%= link_to( "&#8593;", {:action => "move_up", :id => context.id}, :title => "Move up" ) %>
<%= link_to( "&#8595;", {:action => "move_down", :id => context.id}, :title => "Move down" ) %>
<%= link_to( "&#8671;", {:action => "move_bottom", :id => context.id}, :title => "Move to bottom" ) %>
</div>
<div class="data">
<%= link_to( "#{context.name}", :action => "show", :name => urlize(context.name) ) %><%= " (" + Todo.count( "context_id=#{context.id} AND done=0" ).to_s + " actions)" %>

View file

@ -8,7 +8,10 @@
<div id="project-<%= project.id %>" class="odd_row" style="display:'';">
<% end %>
<div class="position">
<%= project.position.to_s %>
<%= link_to( "&#8670;", {:action => "move_top", :id => project.id}, :title => "Move to top" ) %>
<%= link_to( "&#8593;", {:action => "move_up", :id => project.id}, :title => "Move up" ) %>
<%= link_to( "&#8595;", {:action => "move_down", :id => project.id}, :title => "Move down" ) %>
<%= link_to( "&#8671;", {:action => "move_bottom", :id => project.id}, :title => "Move to bottom" ) %>
</div>
<div class="data">
<%= link_to( "#{project.name}", :action => "show", :name => urlize(project.name) ) %><%= " (" + Todo.count( "project_id=#{project.id} AND done=0" ).to_s + " actions)" %>

View file

@ -28,6 +28,10 @@ Project wiki: <http://www.rousette.org.uk/projects/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

View file

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