The dropdowns for contexts and projects are now ordered by the position attribute, so if you move your 'default' context or project to the top of the list in /contexts and /projects, that will be the default option in the dropdown.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@95 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-06-04 17:11:59 +00:00
parent c772ddd282
commit 9f89610fab
5 changed files with 27 additions and 25 deletions

View file

@ -25,8 +25,8 @@ class ContextController < ApplicationController
#
def show
@context = Context.find_by_name(@params["name"].humanize)
@places = Context.find(:all)
@projects = Project.find(:all)
@places = Context.find(:all, :order => "position ASC")
@projects = Project.find(:all, :order => "position ASC")
@page_title = "TRACKS::Context: #{@context.name}"
@not_done = Todo.find(:all, :conditions => "done=0 AND context_id=#{@context.id}",
:order => "due IS NULL, due ASC, created ASC")
@ -63,8 +63,8 @@ class ContextController < ApplicationController
# Edit the details of the action in this context
#
def update_action
@places = Context.find(:all)
@projects = Project.find(:all)
@places = Context.find(:all, :order => "position ASC")
@projects = Project.find(:all, :order => "position ASC")
action = Todo.find(params[:id])
action.attributes = @params["item"]
if action.due?
@ -85,8 +85,8 @@ class ContextController < ApplicationController
# Parameters from form fields are passed to create new action
#
def add_item
@projects = Project.find( :all )
@places = Context.find( :all )
@projects = Project.find( :all, :order => "position ASC" )
@places = Context.find( :all, :order => "position ASC" )
item = Todo.new
item.attributes = @params["new_item"]
@ -133,8 +133,8 @@ class ContextController < ApplicationController
# Toggles the 'done' status of the action
#
def toggle_check
@places = Context.find(:all)
@projects = Project.find(:all)
@places = Context.find(:all, :order => "position ASC")
@projects = Project.find(:all, :order => "position ASC")
item = Todo.find(params[:id])

View file

@ -25,8 +25,8 @@ class ProjectController < ApplicationController
#
def show
@project = Project.find_by_name(@params["name"].humanize)
@places = Context.find(:all)
@projects = Project.find(:all)
@places = Context.find(:all, :order => "position ASC")
@projects = Project.find(:all, :order => "position ASC")
@page_title = "TRACKS::Project: #{@project.name}"
@not_done = Todo.find(:all, :conditions => "done=0 AND project_id=#{@project.id}",
:order => "due IS NULL, due ASC, created ASC")
@ -61,8 +61,8 @@ class ProjectController < ApplicationController
# Edit the details of the action in this project
#
def update_action
@places = Context.find(:all)
@projects = Project.find(:all)
@places = Context.find(:all, :order => "position ASC")
@projects = Project.find(:all, :order => "position ASC")
action = Todo.find(params[:id])
action.attributes = @params["item"]
@ -84,8 +84,8 @@ class ProjectController < ApplicationController
# Parameters from form fields are passed to create new action
#
def add_item
@projects = Project.find( :all )
@places = Context.find( :all )
@projects = Project.find( :all, :order => "position ASC" )
@places = Context.find( :all, :order => "position ASC" )
item = Todo.new
item.attributes = @params["new_item"]
@ -133,8 +133,8 @@ class ProjectController < ApplicationController
# Toggles the 'done' status of the action
#
def toggle_check
@places = Context.find(:all)
@projects = Project.find(:all)
@places = Context.find(:all, :order => "position ASC")
@projects = Project.find(:all, :order => "position ASC")
item = Todo.find(@params['id'])
item.toggle!('done')

View file

@ -17,8 +17,8 @@ class TodoController < ApplicationController
#
def list
@page_title = "TRACKS::List tasks"
@projects = Project.find( :all )
@places = Context.find( :all )
@projects = Project.find( :all, :order => "position ASC" )
@places = Context.find( :all, :order => "position ASC" )
@shown_places = Context.find( :all, :conditions => "hide=0", :order => "position ASC" )
@hidden_places = Context.find( :all, :conditions => "hide=1", :order => "position ASC" )
@done = Todo.find( :all, :conditions => "done=1", :order => "completed DESC",
@ -72,8 +72,8 @@ class TodoController < ApplicationController
# Parameters from form fields are passed to create new action
# in the selected context.
def add_item
@projects = Project.find( :all )
@places = Context.find( :all )
@projects = Project.find( :all, :order => "position ASC" )
@places = Context.find( :all, :order => "position ASC" )
item = Todo.new
item.attributes = @params["new_item"]
@ -95,8 +95,8 @@ class TodoController < ApplicationController
# Edit the details of an action
#
def update_action
@places = Context.find(:all)
@projects = Project.find(:all)
@places = Context.find(:all, :order => "position ASC")
@projects = Project.find(:all, :order => "position ASC")
action = Todo.find(params[:id])
action.attributes = @params["item"]
if action.due?
@ -128,8 +128,8 @@ class TodoController < ApplicationController
# Toggles the 'done' status of the action
#
def toggle_check
@projects = Project.find(:all)
@places = Context.find(:all)
@projects = Project.find(:all, :order => "position ASC")
@places = Context.find(:all, :order => "position ASC")
item = Todo.find(@params['id'])

View file

@ -10,7 +10,7 @@
<% @not_done = Todo.find_all("done=0 AND context_id=#{@shown_place.id}", "due IS NULL, due ASC, created ASC") -%>
<% if !@not_done.empty? -%>
<div class="contexts">
<h2><a href="javascript:toggleSingle('c<%=@shown_place.id%>');javascript:toggleImage('toggle_context_<%=@shown_place.id%>')"><%= image_tag("collapse.png", :name=>"toggle_context_#{@shown_place.id}", :border=>"0") %></a>
<h2><a href="javascript:toggleSingle('c<%=@shown_place.id%>');javascript:toggleImage('toggle_context_<%=@shown_place.id%>')" class="refresh"><%= image_tag("collapse.png", :name=>"toggle_context_#{@shown_place.id}", :border=>"0") %></a>
<%= link_to( "#{@shown_place.name}", :controller => "context", :action => "show", :name => urlize(@shown_place.name) ) %></h2>
<div id="c<%= @shown_place.id %>" class="next_actions">

View file

@ -148,6 +148,8 @@ h2 a:hover {
background-color: transparent;
text-decoration: none;
}
a.refresh, a.refresh:link, a.refresh:active {color: #57A620;}
#input_box {
margin-left: 490px;