From 9f89610fab2a619fdb85d7184a9d1a0709d2667c Mon Sep 17 00:00:00 2001 From: bsag Date: Sat, 4 Jun 2005 17:11:59 +0000 Subject: [PATCH] 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 --- tracks/app/controllers/context_controller.rb | 16 ++++++++-------- tracks/app/controllers/project_controller.rb | 16 ++++++++-------- tracks/app/controllers/todo_controller.rb | 16 ++++++++-------- tracks/app/views/todo/list.rhtml | 2 +- tracks/public/stylesheets/standard.css | 2 ++ 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index bfc0c96c..ab4f3f47 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -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]) diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index 2ceb6c5a..99f5bb4e 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -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') diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index aae6dc09..9ea04487 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -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']) diff --git a/tracks/app/views/todo/list.rhtml b/tracks/app/views/todo/list.rhtml index 4f7f6272..c6a44ca8 100644 --- a/tracks/app/views/todo/list.rhtml +++ b/tracks/app/views/todo/list.rhtml @@ -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? -%>
-

<%= image_tag("collapse.png", :name=>"toggle_context_#{@shown_place.id}", :border=>"0") %> +

<%= image_tag("collapse.png", :name=>"toggle_context_#{@shown_place.id}", :border=>"0") %> <%= link_to( "#{@shown_place.name}", :controller => "context", :action => "show", :name => urlize(@shown_place.name) ) %>

diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index b204387b..40668b04 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -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;