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.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@93 a4c988fc-2ded-0310-b66e-134b36920a42
|
|
@ -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'
|
||||
|
||||
|
|
@ -30,4 +31,17 @@ class ApplicationController < ActionController::Base
|
|||
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
|
||||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -1,17 +1,21 @@
|
|||
<% context = context_listing %>
|
||||
<div id="context-<%= context.id %>-container" class="container">
|
||||
<div id="context-<%= context.id %>-container">
|
||||
<!-- %= error_messages_for 'context' % -->
|
||||
<div id="context-<%= context.id %>-display" class="list">
|
||||
<div id="context-<%= context.id %>-display">
|
||||
<% if context.position % 2 == 0 %>
|
||||
<div id="context-<%= context.id %>" class="even_row" style="display:'';">
|
||||
<% else %>
|
||||
<div id="context-<%= context.id %>" class="odd_row" style="display:'';">
|
||||
<% end %>
|
||||
<div class="position">
|
||||
<%= 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") %>
|
||||
</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)" %>
|
||||
|
|
@ -24,11 +28,11 @@
|
|||
<input type="checkbox" value="0" disabled="true" />
|
||||
<% 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}');" ) %>
|
||||
</div>
|
||||
</div><!-- [end:context-context.id] -->
|
||||
|
||||
|
|
|
|||
|
|
@ -11,14 +11,18 @@
|
|||
|
||||
<div id="item-<%= item.id %>">
|
||||
<div class="big-box">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" onclick="document.forms['checkbox-notdone-<%= item.id %>'].onsubmit();" />
|
||||
<%=
|
||||
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 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}\'?" ) + " "
|
||||
: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}');" ) + " "
|
||||
%>
|
||||
<!-- begin div.checkbox -->
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" onclick="document.forms['checkbox-notdone-<%= item.id %>'].onsubmit();" />
|
||||
</div>
|
||||
<!-- end div.checkbox -->
|
||||
</div>
|
||||
<!-- start of div which has a class 'description' or 'stale_7d', 'stale_14d' etc -->
|
||||
<%= 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? %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" class=\"show_notes\" title=\"Show notes\">" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "</a>" %>
|
||||
<% m_notes = markdown( item.notes ) %>
|
||||
<%= "<div class=\"notes\" id=\"" + item.id.to_s + "\" style=\"display:none\">" + m_notes + "</div>" %>
|
||||
<% end %>
|
||||
|
|
@ -58,14 +62,19 @@
|
|||
|
||||
<div id="done-item-<%= item.id %>">
|
||||
<div class="big-box">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" checked="checked" onclick="document.forms['checkbox-done-<%= item.id %>'].onsubmit();" />
|
||||
<%=
|
||||
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") %>
|
||||
</div><!-- [end:big-box] -->
|
||||
<!-- begin div.checkbox -->
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" checked="checked" onclick="document.forms['checkbox-done-<%= item.id %>'].onsubmit();" />
|
||||
</div>
|
||||
<!-- end div.checkbox -->
|
||||
<div class="description">
|
||||
<span class="grey"><%= format_date( item.completed ) %></span>
|
||||
<%= 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? %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" class=\"show_notes\" title=\"Show notes\">" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "</a>" %>
|
||||
<% m_notes = markdown( item.notes ) %>
|
||||
<%= "<div class=\"notes\" id=\"" + item.id.to_s + "\" style=\"display:none\">" + m_notes + "</div>" %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -8,10 +8,14 @@
|
|||
<div id="project-<%= project.id %>" class="odd_row" style="display:'';">
|
||||
<% end %>
|
||||
<div class="position">
|
||||
<%= 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") %>
|
||||
</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)" %>
|
||||
|
|
@ -23,11 +27,11 @@
|
|||
<input type="checkbox" value="0" disabled="true" />
|
||||
<% 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}');" ) %>
|
||||
</div>
|
||||
</div><!-- [end:project-project.id] -->
|
||||
|
||||
|
|
|
|||
|
|
@ -11,15 +11,19 @@
|
|||
|
||||
<div id="item-<%= item.id %>">
|
||||
<div class="big-box">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" onclick="document.forms['checkbox-notdone-<%= item.id %>'].onsubmit();" />
|
||||
<%=
|
||||
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}');" ) + " "
|
||||
%>
|
||||
</div>
|
||||
<!-- begin div.checkbox -->
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" onclick="document.forms['checkbox-notdone-<%= item.id %>'].onsubmit();" />
|
||||
</div>
|
||||
<!-- end div.checkbox -->
|
||||
<!-- start of div which has a class 'description' or 'stale_7d', 'stale_14d' etc -->
|
||||
<%= 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? %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" class=\"show_notes\" title=\"Show notes\">" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "</a>" %>
|
||||
<% m_notes = markdown( item.notes ) %>
|
||||
<%= "<div class=\"notes\" id=\"" + item.id.to_s + "\" style=\"display:none\">" + m_notes + "</div>" %>
|
||||
<% end %>
|
||||
|
|
@ -58,14 +62,18 @@
|
|||
|
||||
<div id="done-item-<%= item.id %>">
|
||||
<div class="big-box">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" checked="checked" onclick="document.forms['checkbox-done-<%= item.id %>'].onsubmit();" />
|
||||
<%=
|
||||
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}\'?" ) + " "
|
||||
%>
|
||||
</div><!-- [end:big-box] -->
|
||||
<!-- begin div.checkbox -->
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" checked="checked" onclick="document.forms['checkbox-done-<%= item.id %>'].onsubmit();" />
|
||||
</div>
|
||||
<!-- end div.checkbox -->
|
||||
<div class="description">
|
||||
<span class="grey"><%= format_date( item.completed ) %></span>
|
||||
<%= 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? %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" class=\"show_notes\" title=\"Show notes\">" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "</a>" %>
|
||||
<% m_notes = markdown( item.notes ) %>
|
||||
<%= "<div class=\"notes\" id=\"" + item.id.to_s + "\" style=\"display:none\">" + m_notes + "</div>" %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<%
|
||||
@item = action_edit_form
|
||||
%>
|
||||
<!-- %= error_messages_for 'item' % -->
|
||||
<%= error_messages_for("item") %>
|
||||
|
||||
<%= hidden_field( "item", "id" ) %>
|
||||
<table>
|
||||
<tr>
|
||||
|
|
|
|||
|
|
@ -11,15 +11,19 @@
|
|||
|
||||
<div id="item-<%= item.id %>">
|
||||
<div class="big-box">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" onclick="document.forms['checkbox-notdone-<%= item.id %>'].onsubmit();" />
|
||||
<%=
|
||||
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 => "todo", :action => "destroy_action", :id => item.id }, :confirm => "Are you sure that you want to delete the action \'#{item.description}\'?" ) + " "
|
||||
: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}')" ) + " "
|
||||
%>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" onclick="document.forms['checkbox-notdone-<%= item.id %>'].onsubmit();" />
|
||||
</div>
|
||||
<!-- start of div which has a class 'description' or 'stale_7d', 'stale_14d' etc -->
|
||||
<%= 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? %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" class=\"show_notes\" title=\"Show notes\">" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "</a>" %>
|
||||
<% m_notes = markdown( item.notes ) %>
|
||||
<%= "<div class=\"notes\" id=\"" + item.id.to_s + "\" style=\"display:none\">" + m_notes + "</div>" %>
|
||||
<% end %>
|
||||
|
|
@ -58,14 +62,19 @@
|
|||
|
||||
<div id="done-item-<%= item.id %>">
|
||||
<div class="big-box">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" checked="checked" onclick="document.forms['checkbox-done-<%= item.id %>'].onsubmit();" />
|
||||
<%=
|
||||
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") %>
|
||||
</div><!-- [end:big-box] -->
|
||||
<!-- begin div.checkbox -->
|
||||
<div class="checkbox">
|
||||
<input type="checkbox" name="item_id" value="<%= item.id %>" checked="checked" onclick="document.forms['checkbox-done-<%= item.id %>'].onsubmit();" />
|
||||
</div>
|
||||
<!-- end div.checkbox -->
|
||||
<div class="description">
|
||||
<span class="grey"><%= format_date( item.completed ) %></span>
|
||||
<%= 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? %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" title=\"Show notes\">" + image_tag( "notes", :width=>"10", :height=>"10", :border=>"0") + "</a>" %>
|
||||
<%= "<a href=\"javascript:Element.toggle('" + item.id.to_s + "')\" class=\"show_notes\" title=\"Show notes\">" + image_tag( "blank", :width=>"16", :height=>"16", :border=>"0" ) + "</a>" %>
|
||||
<% m_notes = markdown( item.notes ) %>
|
||||
<%= "<div class=\"notes\" id=\"" + item.id.to_s + "\" style=\"display:none\">" + m_notes + "</div>" %>
|
||||
<% end %>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
<!-- begin div.new_actions -->
|
||||
<div id="new_actions" class="new_actions" style="display:none">
|
||||
<h2>Fresh actions (hit refresh to sort)</h2>
|
||||
<h2>Fresh actions (hit <a href="javascript:window.location.reload()">refresh</a> to sort)</h2>
|
||||
</div>
|
||||
<!-- end div.new_actions -->
|
||||
|
||||
|
|
@ -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? -%>
|
||||
<div class="contexts">
|
||||
<h2><a href="javascript:toggleSingle('c<%=@shown_place.id%>');javascript:toggleImage('toggle_context_<%=@shown_place.id%>')">
|
||||
<img src="/images/collapse.png" name="toggle_context_<%= @shown_place.id %>"/></a><%= link_to( "#{@shown_place.name}", :controller => "context", :action => "show", :name => urlize(@shown_place.name) ) %></h2>
|
||||
<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>
|
||||
<%= link_to( "#{@shown_place.name}", :controller => "context", :action => "show", :name => urlize(@shown_place.name) ) %></h2>
|
||||
|
||||
<div id="c<%= @shown_place.id %>" class="next_actions">
|
||||
<% if @not_done.empty? -%>
|
||||
|
|
@ -92,14 +92,14 @@
|
|||
<h3>Active Contexts:</h3>
|
||||
<ul>
|
||||
<% for other_context in Context.find(:all, :conditions => "hide=0", :order => "position ASC") %>
|
||||
<li><%= link_to( other_context.name, { :controller => "context", :action => "show", :name => urlize(other_context.name) } ) + " (" + Todo.count( "project_id=#{other_context.id} AND done=0" ).to_s + " actions)" %></li>
|
||||
<li><%= link_to( other_context.name, { :controller => "context", :action => "show", :name => urlize(other_context.name) } ) + " (" + Todo.count( "context_id=#{other_context.id} AND done=0" ).to_s + " actions)" %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
|
||||
<h3>Hidden Contexts:</h3>
|
||||
<ul>
|
||||
<% for other_context in Context.find(:all, :conditions => "hide=1", :order => "position ASC") %>
|
||||
<li><%= link_to( other_context.name, { :controller => "context", :action => "show", :name => urlize(other_context.name) } ) + " (" + Todo.count( "project_id=#{other_context.id} AND done=0" ).to_s + " actions)" %></li>
|
||||
<li><%= link_to( other_context.name, { :controller => "context", :action => "show", :name => urlize(other_context.name) } ) + " (" + Todo.count( "context_id=#{other_context.id} AND done=0" ).to_s + " actions)" %></li>
|
||||
<% end %>
|
||||
</ul>
|
||||
</div><!-- End of input box -->
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
253
tracks/lib/math/statistics.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require File.dirname(__FILE__) + "/../config/environment"
|
||||
require 'dispatcher'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
|
||||
|
||||
|
|
|
|||
BIN
tracks/public/images/blank.png
Normal file
|
After Width: | Height: | Size: 156 B |
BIN
tracks/public/images/bottom_off.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
tracks/public/images/bottom_on.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 103 B |
BIN
tracks/public/images/delete_off.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
tracks/public/images/delete_on.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
tracks/public/images/down_off.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
tracks/public/images/down_on.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.6 KiB |
|
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
tracks/public/images/notes_off.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
tracks/public/images/notes_on.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 3.6 KiB |
BIN
tracks/public/images/top_on.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
tracks/public/images/up_off.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
tracks/public/images/up_on.png
Normal file
|
After Width: | Height: | Size: 3.7 KiB |
|
|
@ -13,8 +13,6 @@ p {
|
|||
padding: 2px;
|
||||
}
|
||||
|
||||
img {border: 0px;}
|
||||
|
||||
a, a:link, a:active, a:visited {
|
||||
color: #cc3334;
|
||||
text-decoration: none;
|
||||
|
|
@ -27,6 +25,31 @@ a:hover {
|
|||
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 */
|
||||
|
||||
#display_box {
|
||||
|
|
@ -146,14 +169,20 @@ h2 a:hover {
|
|||
width: 20px;
|
||||
}
|
||||
|
||||
.big-box {
|
||||
div.big-box, div.big-box a, div.big-box a:hover {
|
||||
float: left;
|
||||
width: 55px;
|
||||
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;
|
||||
|
|
@ -335,6 +360,29 @@ table.list {
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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' ..."
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
require 'rubygems'
|
||||
require_gem 'rails'
|
||||
require 'breakpoint_client'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
irb = RUBY_PLATFORM =~ /mswin32/ ? 'irb.bat' : 'irb'
|
||||
|
||||
require 'optparse'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
ActiveRecord::Base.lock_mutex
|
||||
ActiveRecord::Base.connection.begin_db_transaction
|
||||
at_exit do
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
ActiveRecord::Base.lock_mutex
|
||||
ActiveRecord::Base.connection.begin_db_transaction
|
||||
at_exit do
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
|
||||
if ARGV.empty?
|
||||
puts "Usage: profiler 'Person.expensive_method(10)' [times]"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require File.dirname(__FILE__) + '/../config/environment'
|
||||
eval(ARGV.first)
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/local/bin/ruby
|
||||
#!/usr/bin/ruby
|
||||
|
||||
require 'webrick'
|
||||
require 'optparse'
|
||||
|
|
|
|||