diff --git a/tracks/app/controllers/application.rb b/tracks/app/controllers/application.rb index 5fd627c2..5239b4e4 100644 --- a/tracks/app/controllers/application.rb +++ b/tracks/app/controllers/application.rb @@ -2,6 +2,7 @@ # Likewise will all the methods added be available for all controllers. require_dependency "login_system" +require_dependency "math/statistics" require 'date' @@ -29,5 +30,18 @@ class ApplicationController < ActionController::Base def errors_for( obj ) error_messages_for( obj ) unless instance_eval("@#{obj}").nil? end + + def av_completed + completed = Todo.find(:all, :conditions => "done=1") + days = [] + completed.each do |i| + days << (i.completed - i.created).to_f + end + return days.average, days.max + end +end + +class Array + include Math::Statistics end \ No newline at end of file diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index 198bfc14..aae6dc09 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -23,6 +23,7 @@ class TodoController < ApplicationController @hidden_places = Context.find( :all, :conditions => "hide=1", :order => "position ASC" ) @done = Todo.find( :all, :conditions => "done=1", :order => "completed DESC", :limit => NO_OF_ACTIONS ) + @av_days_to_completion, @max_days_to_completion = av_completed() # Set count badge to number of not-done, not hidden context items @count = count_shown_items( @hidden_places ) diff --git a/tracks/app/models/todo.rb b/tracks/app/models/todo.rb index 54511650..56bb52f6 100644 --- a/tracks/app/models/todo.rb +++ b/tracks/app/models/todo.rb @@ -5,9 +5,9 @@ class Todo < ActiveRecord::Base # Description field can't be empty, and must be < 100 bytes # Notes must be < 60,000 bytes (65,000 actually, but I'm being cautious) - validates_presence_of :description, :message => "no description provided" - validates_length_of :description, :maximum => 100, :message => "description is too long" - validates_length_of :notes, :maximum => 60000, :message => "notes are too long" + validates_presence_of :description + validates_length_of :description, :maximum => 100 + validates_length_of :notes, :maximum => 60000 # Add a creation date (Ruby object format) to item before it's saved # if there is no existing creation date (this prevents creation date diff --git a/tracks/app/views/context/_context_listing.rhtml b/tracks/app/views/context/_context_listing.rhtml index 9ce946ee..48e59fbe 100644 --- a/tracks/app/views/context/_context_listing.rhtml +++ b/tracks/app/views/context/_context_listing.rhtml @@ -1,17 +1,21 @@ <% context = context_listing %> -
+
-
+
<% if context.position % 2 == 0 %>
<% else %>
<% end %>
- <%= 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(image_tag("blank", :title=>"Move to top", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_top", :id => context.id}, :title => "Move to top", :class=>"to_top") %> + <%= link_to(image_tag("blank", :title=>"Move up", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_up", :id => context.id}, :title => "Move up", :class=>"up" ) %> + <%= link_to(image_tag("blank", :title=>"Move down", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_down", :id => context.id}, :title => "Move down", :class=>"down") %> + <%= link_to(image_tag("blank", :title=>"Move to bottom", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_bottom", :id => context.id}, :title => "Move to bottom", :class=>"to_bottom") %>
<%= link_to( "#{context.name}", :action => "show", :name => urlize(context.name) ) %><%= " (" + Todo.count( "context_id=#{context.id} AND done=0" ).to_s + " actions)" %> @@ -24,11 +28,11 @@ <% end %> -<%= link_to_function(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), "Element.toggle('context-#{context.id}','context-#{context.id}-edit-form'); new Effect.Appear('context-#{context.id}-edit-form'); Form.focus_first('form-context-#{context.id}');" ) + " " + - link_to_remote( image_tag("delete", :title =>"Delete this context", :height=>"10", :width=>"10", :border=>"0"), +<%= link_to_remote( image_tag("blank", :title =>"Delete context", :class=>"delete_item"), :update => "context-#{context.id}-container", :loading => "new Effect.Squish('context-#{context.id}-container')", - :url => { :controller => "context", :action => "destroy", :id => context.id }, :confirm => "Are you sure that you want to delete the context \'#{context.name}\'?" ) %> + :url => { :controller => "context", :action => "destroy", :id => context.id }, :confirm => "Are you sure that you want to delete the context \'#{context.name}\'?" ) + " " + + link_to_function( image_tag( "blank", :title => "Edit context", :class=>"edit_item"), "Element.toggle('context-#{context.id}','context-#{context.id}-edit-form'); new Effect.Appear('context-#{context.id}-edit-form'); Form.focus_first('form-context-#{context.id}');" ) %>
diff --git a/tracks/app/views/context/_show_items.rhtml b/tracks/app/views/context/_show_items.rhtml index 7a52d20f..074521c5 100644 --- a/tracks/app/views/context/_show_items.rhtml +++ b/tracks/app/views/context/_show_items.rhtml @@ -11,14 +11,18 @@
- <%= - link_to_function(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), "Element.toggle('item-#{item.id}','action-#{item.id}-edit-form'); new Effect.Appear('action-#{item.id}-edit-form'); Form.focusFirstElement('form-action-#{item.id}');" ) + " " + - link_to_remote( image_tag("delete", :title =>"Delete this action"), - :update => "item-#{item.id}-container", - :loading => "new Effect.Squish('item-#{item.id}-container')", - :url => { :controller => "context", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " + link_to_remote( image_tag("blank", :title =>"Delete this action", :class=>"delete_item"), + :update => "item-#{item.id}-container", + :loading => "new Effect.Squish('item-#{item.id}-container')", + :url => { :controller => "context", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " + + link_to_function(image_tag( "blank", :title => "Edit item", :class=>"edit_item"), "Element.toggle('item-#{item.id}','action-#{item.id}-edit-form'); new Effect.Appear('action-#{item.id}-edit-form'); Form.focusFirstElement('form-action-#{item.id}');" ) + " " %> + +
+ +
+
<%= staleness(item.created) %> @@ -28,7 +32,7 @@ <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %> <% end %> <% if item.notes? %> - <%= "" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "" %> + <%= "" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "" %> <% m_notes = markdown( item.notes ) %> <%= "
" + m_notes + "
" %> <% end %> @@ -58,14 +62,19 @@
- <%= - link_to_remote( image_tag("delete", :title =>"Delete this action"), + link_to_remote( image_tag("blank", :title =>"Delete this action", :class=>"delete_item"), :update => "done-item-#{item.id}-container", :loading => "new Effect.Squish('done-item-#{item.id}-container')", :url => { :controller => "context", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " %> + <%= image_tag("blank") %>
+ +
+ +
+
<%= format_date( item.completed ) %> <%= item.description %> @@ -73,7 +82,7 @@ <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %> <% end %> <% if item.notes? %> - <%= "" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "" %> + <%= "" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "" %> <% m_notes = markdown( item.notes ) %> <%= "
" + m_notes + "
" %> <% end %> diff --git a/tracks/app/views/project/_project_listing.rhtml b/tracks/app/views/project/_project_listing.rhtml index 7dc69ee4..9d01e1e4 100644 --- a/tracks/app/views/project/_project_listing.rhtml +++ b/tracks/app/views/project/_project_listing.rhtml @@ -8,10 +8,14 @@
<% end %>
- <%= 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(image_tag("blank", :title=>"Move to top", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_top", :id => project.id}, :title => "Move to top", :class=>"to_top") %> + <%= link_to(image_tag("blank", :title=>"Move up", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_up", :id => project.id}, :title => "Move up", :class=>"up" ) %> + <%= link_to(image_tag("blank", :title=>"Move down", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_down", :id => project.id}, :title => "Move down", :class=>"down") %> + <%= link_to(image_tag("blank", :title=>"Move to bottom", :border=>"0", :width=>"16", :height=>"16"), + {:action => "move_bottom", :id => project.id}, :title => "Move to bottom", :class=>"to_bottom") %>
<%= link_to( "#{project.name}", :action => "show", :name => urlize(project.name) ) %><%= " (" + Todo.count( "project_id=#{project.id} AND done=0" ).to_s + " actions)" %> @@ -23,11 +27,11 @@ <% end -%> - <%= link_to_function(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focus_first('form-project-#{project.id}');" ) + " " + - link_to_remote( image_tag("delete", :title =>"Delete this project",:width=>"10", :height=>"10", :border=>"0"), + <%= link_to_remote( image_tag("blank", :title =>"Delete project", :class=>"delete_item"), :update => "project-#{project.id}-container", :loading => "new Effect.Squish('project-#{project.id}-container')", - :url => { :controller => "project", :action => "destroy", :id => project.id }, :confirm => "Are you sure that you want to delete the project \'#{project.name}\'?" ) %> + :url => { :controller => "project", :action => "destroy", :id => project.id }, :confirm => "Are you sure that you want to delete the project \'#{project.name}\'?" ) + " " + + link_to_function(image_tag( "blank", :title => "Edit item", :class=>"edit_item"), "Element.toggle('project-#{project.id}','project-#{project.id}-edit-form'); new Effect.Appear('project-#{project.id}-edit-form'); Form.focus_first('form-project-#{project.id}');" ) %>
diff --git a/tracks/app/views/project/_show_items.rhtml b/tracks/app/views/project/_show_items.rhtml index a60268ca..e7663186 100644 --- a/tracks/app/views/project/_show_items.rhtml +++ b/tracks/app/views/project/_show_items.rhtml @@ -11,15 +11,19 @@
- <%= - link_to_function(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), "Element.toggle('item-#{item.id}','action-#{item.id}-edit-form'); new Effect.Appear('action-#{item.id}-edit-form'); Form.focusFirstElement('form-action-#{item.id}');" ) + " " + - link_to_remote( image_tag("delete", :title =>"Delete this action"), + link_to_remote( image_tag("blank", :title =>"Delete action", :class=>"delete_item"), :update => "item-#{item.id}-container", :loading => "new Effect.Squish('item-#{item.id}-container')", - :url => { :controller => "project", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " + :url => { :controller => "project", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " + + link_to_function(image_tag( "blank", :title => "Edit action", :class=>"edit_item"), "Element.toggle('item-#{item.id}','action-#{item.id}-edit-form'); new Effect.Appear('action-#{item.id}-edit-form'); Form.focusFirstElement('form-action-#{item.id}');" ) + " " %>
+ +
+ +
+ <%= staleness(item.created) %> <%= due_date( item.due ) %> @@ -28,7 +32,7 @@ <%= link_to( "[C]", { :controller => "context", :action => "show", :name => urlize(item.context.name) }, :title => "View context: #{item.context.name}" ) %> <% end %> <% if item.notes? %> - <%= "" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "" %> + <%= "" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "" %> <% m_notes = markdown( item.notes ) %> <%= "
" + m_notes + "
" %> <% end %> @@ -58,14 +62,18 @@
- <%= - link_to_remote( image_tag("delete", :title =>"Delete this action"), + link_to_remote( image_tag("blank", :title =>"Delete action", :class=>"delete_item"), :update => "done-item-#{item.id}-container", :loading => "new Effect.Squish('done-item-#{item.id}-container')", :url => { :controller => "project", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " %>
+ +
+ +
+
<%= format_date( item.completed ) %> <%= item.description %> @@ -73,7 +81,7 @@ <%= link_to( "[C]", { :controller => "context", :action => "show", :name => urlize(item.context.name) }, :title => "View context: #{item.context.name}" ) %> <% end %> <% if item.notes? %> - <%= "" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "" %> + <%= "" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "" %> <% m_notes = markdown( item.notes ) %> <%= "
" + m_notes + "
" %> <% end %> diff --git a/tracks/app/views/todo/_action_edit_form.rhtml b/tracks/app/views/todo/_action_edit_form.rhtml index 870dab0e..aba18f36 100644 --- a/tracks/app/views/todo/_action_edit_form.rhtml +++ b/tracks/app/views/todo/_action_edit_form.rhtml @@ -1,7 +1,8 @@ <% @item = action_edit_form %> - +<%= error_messages_for("item") %> + <%= hidden_field( "item", "id" ) %> diff --git a/tracks/app/views/todo/_show_items.rhtml b/tracks/app/views/todo/_show_items.rhtml index d5424f91..da0dd761 100644 --- a/tracks/app/views/todo/_show_items.rhtml +++ b/tracks/app/views/todo/_show_items.rhtml @@ -11,15 +11,19 @@
- <%= - link_to_function(image_tag( "edit", :title => "Edit item", :width=>"10", :height=>"10", :border=>"0"), "Element.toggle('item-#{item.id}','action-#{item.id}-edit-form'); new Effect.Appear('action-#{item.id}-edit-form'); Form.focusFirstElement('form-action-#{item.id}')" ) + " " + - link_to_remote( image_tag("delete", :title =>"Delete this action"), - :update => "item-#{item.id}-container", - :loading => "new Effect.Squish('item-#{item.id}-container')", - :url => { :controller => "todo", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " + link_to_remote( image_tag("blank", :title =>"Delete action", :class=>"delete_item"), + :update => "item-#{item.id}-container", + :loading => "new Effect.Squish('item-#{item.id}-container')", + :url => { :controller => "todo", :action => "destroy_action", :id => item.id }, + :confirm => "Are you sure that you want to delete the action, \'#{item.description}\'?") + " " + + link_to_function(image_tag( "blank", :title => "Edit action", :class => "edit_item"), + "Element.toggle('item-#{item.id}','action-#{item.id}-edit-form'); new Effect.Appear('action-#{item.id}-edit-form'); Form.focusFirstElement('form-action-#{item.id}')" ) + " " %>
+
+ +
<%= staleness(item.created) %> <%= due_date( item.due ) %> @@ -28,7 +32,7 @@ <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %> <% end %> <% if item.notes? %> - <%= "" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "" %> + <%= "" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "" %> <% m_notes = markdown( item.notes ) %> <%= "
" + m_notes + "
" %> <% end %> @@ -58,14 +62,19 @@
- <%= - link_to_remote( image_tag("delete", :title =>"Delete this action"), + link_to_remote( image_tag("blank", :title =>"Delete action", :class=>"delete_item"), :update => "done-item-#{item.id}-container", :loading => "new Effect.Squish('done-item-#{item.id}-container')", :url => { :controller => "todo", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " " %> + <%= image_tag("blank") %>
+ +
+ +
+
<%= format_date( item.completed ) %> <%= item.description %> @@ -73,7 +82,7 @@ <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %> <% end %> <% if item.notes? %> - <%= "" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "" %> + <%= "" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "" %> <% m_notes = markdown( item.notes ) %> <%= "
" + m_notes + "
" %> <% end %> diff --git a/tracks/app/views/todo/list.rhtml b/tracks/app/views/todo/list.rhtml index 49e8ef9e..4f7f6272 100644 --- a/tracks/app/views/todo/list.rhtml +++ b/tracks/app/views/todo/list.rhtml @@ -2,7 +2,7 @@ @@ -10,8 +10,8 @@ <% @not_done = Todo.find_all("done=0 AND context_id=#{@shown_place.id}", "due IS NULL, due ASC, created ASC") -%> <% if !@not_done.empty? -%>
-

- <%= link_to( "#{@shown_place.name}", :controller => "context", :action => "show", :name => urlize(@shown_place.name) ) %>

+

<%= 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) ) %>

<% if @not_done.empty? -%> @@ -42,7 +42,7 @@
- + <%= link_to_function( "Add the next action in this context »", "Element.toggle('todo_new_action');Element.toggle('new_actions');Form.focusFirstElement('todo-form-new-action');", {:title => "Add the next action [Alt+n]", :accesskey => "n"}) %> diff --git a/tracks/doc/CHANGENOTES.txt b/tracks/doc/CHANGENOTES.txt index f7fdd956..1faa0859 100644 --- a/tracks/doc/CHANGENOTES.txt +++ b/tracks/doc/CHANGENOTES.txt @@ -32,6 +32,7 @@ marked darker yellow, and those created more than 28 days ago (staleness_starts 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. 18. You can mark projects as completed (by editing the project on /projects). In the 'sidebar' active and completed projects are shown separately, but you can still view the completed project. +19. New images (from eclipse.org) for the edit, delete, notes and up, down, top and bottom buttons. I've made a greyscale version for the default, then the coloured version gets loaded when the mouse is hovering over the button. ## Version 1.02 diff --git a/tracks/lib/math/statistics.rb b/tracks/lib/math/statistics.rb new file mode 100644 index 00000000..f63b2c47 --- /dev/null +++ b/tracks/lib/math/statistics.rb @@ -0,0 +1,253 @@ +=begin += module Math::Statistics + +== SYNOPSIS + + ---- + require "math/statistics" + + class Array + include Math::Statistics + end + + a = [-2,-1,1,2] + p a.sum + p a.avg + p a.var + p a.std + p a.Min + p a.Max + ---- + +produces + + ---- + 0.0 + 0.0 + 2.5 + 1.58113883 + -2 + 2 + ---- + +For hashes, + + ---- + require "math/statistics" + + class Hash + include Math::Statistics + Hash::default_block = lambda{|i,j| j} + end + + h = {'alice'=>-2, 'bob'=>-1, 'cris'=>1, 'diana'=>2} + p h.sum + p h.avg + p h.var + p h.std + p h.Min + p h.Max + ---- + +produces + + ---- + 0.0 + 0.0 + 2.5 + 1.58113883 + -2 + 2 + ---- + +== DESCRIPTION + +(({Math::Statistics})) provides basic statistical methods, i.e., +sum, average, variance, standard deviation, min and max. +This module can be used after including to the target class. +The target class must be Enumerable, more precisely, this module +uses each, size, min, and max. + +== CLASS METHOD + +: default_block= aProc + + Sets default block of the class. This block will be used by the methods. + +: default_block + + Returns default block for class if defined. Otherwise nil will be returnd. + +== METHOD + +: default_block= aProc + + Sets default block of the object. This block will be used by the methods. + Priority of the blocks is in the other: in-place given block, + object's default then class's default. + +: default_block + + Returns default block if defined. Otherwise nil will be returnd. + +: sum +: sum{...} + + Returns sum. When a block is given, summation is taken over the + each result of block evaluation. The role of blocks in the below + are same to this one. + +: average +: average{...} +: avg +: avg{...} + + Returns average. + +: variance +: variance{...} +: var +: var{...} + + Returns variance. + +: standard_deviation +: standard_deviation{...} +: std +: std{...} + + Returns standard deviation. + +: Min +: Min{...} + + Returns minimum. + +: Max +: Max{...} + + Returns maximam. + +== AUTHORS + +Gotoken + +== HISTORY + + 2001-02-28 created (gotoken#notwork.org) + +=end + +module Math + module Statistics + VERSION = "2001_02_18" + + def self.append_features(mod) + unless mod < Enumerable + raise TypeError, + "`#{self}' can't be included non Enumerable (#{mod})" + end + + def mod.default_block= (blk) + self.const_set("STAT_BLOCK", blk) + end + + def mod.default_block + defined?(self::STAT_BLOCK) && self::STAT_BLOCK + end + + super + end + + def default_block + @stat_block || type.default_block + end + + def default_block=(blk) + @stat_block = blk + end + + def sum + sum = 0.0 + if block_given? + each{|i| sum += yield(i)} + elsif default_block + each{|i| sum += default_block[*i]} + else + each{|i| sum += i} + end + sum + end + + def average(&blk) + sum(&blk)/size + end + + def variance(&blk) + sum2 = if block_given? + sum{|i| j=yield(i); j*j} + elsif default_block + sum{|i| j=default_block[*i]; j*j} + else + sum{|i| i**2} + end + sum2/size - average(&blk)**2 + end + + def standard_deviation(&blk) + Math::sqrt(variance(&blk)) + end + + def Min(&blk) + if block_given? + if min = find{|i| i} + min = yield(min) + each{|i| + j = yield(i) + min = j if min > j + } + min + end + elsif default_block + if min = find{|i| i} + min = default_block[*min] + each{|i| + j = default_block[*i] + min = j if min > j + } + min + end + else + min() + end + end + + def Max(&blk) + if block_given? + if max = find{|i| i} + max = yield(max) + each{|i| + j = yield(i) + max = j if max < j + } + max + end + elsif default_block + if max = find{|i| i} + max = default_block[*max] + each{|i| + j = default_block[*i] + max = j if max > j + } + max + end + else + max() + end + end + + alias avg average + alias std standard_deviation + alias var variance + end +end diff --git a/tracks/public/dispatch.cgi b/tracks/public/dispatch.cgi index 9b5ae760..9730473f 100755 --- a/tracks/public/dispatch.cgi +++ b/tracks/public/dispatch.cgi @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) diff --git a/tracks/public/dispatch.fcgi b/tracks/public/dispatch.fcgi index 0f1b9b3a..f0be2449 100755 --- a/tracks/public/dispatch.fcgi +++ b/tracks/public/dispatch.fcgi @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" require 'dispatcher' diff --git a/tracks/public/dispatch.rb b/tracks/public/dispatch.rb index 9b5ae760..9730473f 100755 --- a/tracks/public/dispatch.rb +++ b/tracks/public/dispatch.rb @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) diff --git a/tracks/public/images/blank.png b/tracks/public/images/blank.png new file mode 100644 index 00000000..cbee69c9 Binary files /dev/null and b/tracks/public/images/blank.png differ diff --git a/tracks/public/images/bottom_off.png b/tracks/public/images/bottom_off.png new file mode 100644 index 00000000..0b16b28d Binary files /dev/null and b/tracks/public/images/bottom_off.png differ diff --git a/tracks/public/images/bottom_on.png b/tracks/public/images/bottom_on.png new file mode 100644 index 00000000..3a0de9a2 Binary files /dev/null and b/tracks/public/images/bottom_on.png differ diff --git a/tracks/public/images/calendar.gif b/tracks/public/images/calendar.gif deleted file mode 100644 index 49e972ba..00000000 Binary files a/tracks/public/images/calendar.gif and /dev/null differ diff --git a/tracks/public/images/delete_off.png b/tracks/public/images/delete_off.png new file mode 100644 index 00000000..e67fdc2a Binary files /dev/null and b/tracks/public/images/delete_off.png differ diff --git a/tracks/public/images/delete_on.png b/tracks/public/images/delete_on.png new file mode 100644 index 00000000..6b9f0c12 Binary files /dev/null and b/tracks/public/images/delete_on.png differ diff --git a/tracks/public/images/down_off.png b/tracks/public/images/down_off.png new file mode 100644 index 00000000..933c5015 Binary files /dev/null and b/tracks/public/images/down_off.png differ diff --git a/tracks/public/images/down_on.png b/tracks/public/images/down_on.png new file mode 100644 index 00000000..dc37cd8e Binary files /dev/null and b/tracks/public/images/down_on.png differ diff --git a/tracks/public/images/delete.png b/tracks/public/images/edit_off.png similarity index 72% rename from tracks/public/images/delete.png rename to tracks/public/images/edit_off.png index c697ec94..d7e9d3e3 100644 Binary files a/tracks/public/images/delete.png and b/tracks/public/images/edit_off.png differ diff --git a/tracks/public/images/edit.png b/tracks/public/images/edit_on.png similarity index 72% rename from tracks/public/images/edit.png rename to tracks/public/images/edit_on.png index 964ed01e..650ccc93 100644 Binary files a/tracks/public/images/edit.png and b/tracks/public/images/edit_on.png differ diff --git a/tracks/public/images/notes_off.png b/tracks/public/images/notes_off.png new file mode 100644 index 00000000..11cd7d31 Binary files /dev/null and b/tracks/public/images/notes_off.png differ diff --git a/tracks/public/images/notes_on.png b/tracks/public/images/notes_on.png new file mode 100644 index 00000000..ede65bc0 Binary files /dev/null and b/tracks/public/images/notes_on.png differ diff --git a/tracks/public/images/notes.png b/tracks/public/images/top_off.png similarity index 71% rename from tracks/public/images/notes.png rename to tracks/public/images/top_off.png index 6747154f..c051ba41 100644 Binary files a/tracks/public/images/notes.png and b/tracks/public/images/top_off.png differ diff --git a/tracks/public/images/top_on.png b/tracks/public/images/top_on.png new file mode 100644 index 00000000..30aca0c8 Binary files /dev/null and b/tracks/public/images/top_on.png differ diff --git a/tracks/public/images/up_off.png b/tracks/public/images/up_off.png new file mode 100644 index 00000000..fdacb0e2 Binary files /dev/null and b/tracks/public/images/up_off.png differ diff --git a/tracks/public/images/up_on.png b/tracks/public/images/up_on.png new file mode 100644 index 00000000..2b0aa78b Binary files /dev/null and b/tracks/public/images/up_on.png differ diff --git a/tracks/public/stylesheets/standard.css b/tracks/public/stylesheets/standard.css index ce027545..b204387b 100644 --- a/tracks/public/stylesheets/standard.css +++ b/tracks/public/stylesheets/standard.css @@ -13,8 +13,6 @@ p { padding: 2px; } -img {border: 0px;} - a, a:link, a:active, a:visited { color: #cc3334; text-decoration: none; @@ -26,6 +24,31 @@ a:hover { color: #fff; background-color: #cc3334; } + + +/* Rules for the icon links */ + +img.edit_item {background-image: url(../images/edit_off.png); background-repeat: no-repeat; border: none;} +a:hover img.edit_item {background-image: url(../images/edit_on.png); background-color: transparent; background-repeat: no-repeat; border: none;} + +img.delete_item {background-image: url(../images/delete_off.png); background-repeat: no-repeat; border: none;} +a:hover img.delete_item {background-image: url(../images/delete_on.png);background-color: transparent;background-repeat: no-repeat; border: none;} + +a.to_top {background: transparent url(../images/top_off.png) no-repeat;} +a.to_top:hover {background: transparent url(../images/top_on.png) no-repeat;} + +a.up {background: transparent url(../images/up_off.png) no-repeat;} +a.up:hover {background: transparent url(../images/up_on.png) no-repeat;} + +a.down {background: transparent url(../images/down_off.png) no-repeat;} +a.down:hover {background: transparent url(../images/down_on.png) no-repeat;} + +a.to_bottom {background: transparent url(../images/bottom_off.png) no-repeat;} +a.to_bottom:hover {background: transparent url(../images/bottom_on.png) no-repeat;} + +a.show_notes {background-image: url(../images/notes_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;} +a.show_notes:hover {background-image: url(../images/notes_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;} + /* Structural divs */ @@ -146,14 +169,20 @@ h2 a:hover { width: 20px; } -.big-box { - float: left; - width: 55px; +div.big-box, div.big-box a, div.big-box a:hover { + float: left; vertical-align: middle; + background-color: transparent; } - + +.checkbox { + float: left; + margin-left: 10px; + vertical-align: middle; + } + .description { - margin-left: 60px; + margin-left: 70px; margin-right: 10px; } @@ -258,19 +287,19 @@ h2 a:hover { The colour of the background gets progressively yellower with age */ .stale_l1 { - margin-left: 60px; + margin-left: 70px; margin-right: 10px; background: #ffffCC; } .stale_l2 { - margin-left: 60px; + margin-left: 70px; margin-right: 10px; background: #ffff66; } .stale_l3 { - margin-left: 60px; + margin-left: 70px; margin-right: 10px; background: #ffff00; } @@ -323,10 +352,6 @@ input { } /* Positioning the 'cells' in the list */ -.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 { margin-top: 0px; border-top: 1px solid #ccc; @@ -334,6 +359,29 @@ table.list { border-right: 1px solid #ccc; background: #fff; } + +.position { + float: left; + } + +img.position, a:hover img.position { + text-align: left; + vertical-align: middle; + background-color: transparent; + } + +.data { + text-align: left; + margin-left: 40px; + float: left; + } + +div.buttons, div.buttons a, div.buttons a:hover { + text-align: right; + margin-right: 0px; + vertical-align: middle; + background-color: transparent; + } div#list-projects, div#list-contexts { border: 1px solid #999; diff --git a/tracks/script/benchmarker b/tracks/script/benchmarker index b07ddcfc..75703f56 100755 --- a/tracks/script/benchmarker +++ b/tracks/script/benchmarker @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby if ARGV.empty? puts "Usage: benchmarker times 'Person.expensive_way' 'Person.another_expensive_way' ..." diff --git a/tracks/script/breakpointer b/tracks/script/breakpointer index 13666415..6964c9f1 100755 --- a/tracks/script/breakpointer +++ b/tracks/script/breakpointer @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require 'rubygems' require_gem 'rails' require 'breakpoint_client' diff --git a/tracks/script/console b/tracks/script/console index fa7acc15..22a487f4 100755 --- a/tracks/script/console +++ b/tracks/script/console @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb' require 'optparse' diff --git a/tracks/script/console_sandbox b/tracks/script/console_sandbox index 9f754bd7..de155152 100755 --- a/tracks/script/console_sandbox +++ b/tracks/script/console_sandbox @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby ActiveRecord::Base.lock_mutex ActiveRecord::Base.connection.begin_db_transaction at_exit do diff --git a/tracks/script/console_sandbox.rb b/tracks/script/console_sandbox.rb index 9f754bd7..de155152 100755 --- a/tracks/script/console_sandbox.rb +++ b/tracks/script/console_sandbox.rb @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby ActiveRecord::Base.lock_mutex ActiveRecord::Base.connection.begin_db_transaction at_exit do diff --git a/tracks/script/destroy b/tracks/script/destroy index ba6dc770..34070bbb 100755 --- a/tracks/script/destroy +++ b/tracks/script/destroy @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require File.dirname(__FILE__) + '/../config/environment' require 'rails_generator' require 'rails_generator/scripts/destroy' diff --git a/tracks/script/generate b/tracks/script/generate index dde69e61..ea78b2f0 100755 --- a/tracks/script/generate +++ b/tracks/script/generate @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require File.dirname(__FILE__) + '/../config/environment' require 'rails_generator' require 'rails_generator/scripts/generate' diff --git a/tracks/script/profiler b/tracks/script/profiler index f0f14a2b..432a3c80 100755 --- a/tracks/script/profiler +++ b/tracks/script/profiler @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby if ARGV.empty? puts "Usage: profiler 'Person.expensive_method(10)' [times]" diff --git a/tracks/script/runner b/tracks/script/runner index acb18f00..5effaa17 100755 --- a/tracks/script/runner +++ b/tracks/script/runner @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require File.dirname(__FILE__) + '/../config/environment' eval(ARGV.first) \ No newline at end of file diff --git a/tracks/script/server b/tracks/script/server index ae0bc8de..a53a4d28 100755 --- a/tracks/script/server +++ b/tracks/script/server @@ -1,4 +1,4 @@ -#!/usr/local/bin/ruby +#!/usr/bin/ruby require 'webrick' require 'optparse'