Bug #300: Displays pending state and successor information

Pending state is displayed in the date_span. Successor information is displayed in the tooltip of a successor icon placed after the action description.

Conflicts:

	app/helpers/todos_helper.rb
	public/javascripts/application.js
This commit is contained in:
Eric Allen 2009-11-04 22:45:02 -05:00
parent 2bf48a15cb
commit 6d97bca57f
7 changed files with 16 additions and 10 deletions

View file

@ -83,12 +83,14 @@ module TodosHelper
def remote_toggle_checkbox
check_box_tag('item_id', toggle_check_todo_path(@todo), @todo.completed?, :class => 'item-checkbox',
:disabled => @todo.pending?)
:title => @todo.pending? ? 'Blocked by ' + @todo.uncompleted_predecessors.map(&:description).join(', ') : "", :readonly => @todo.pending?)
end
def date_span
if @todo.completed?
"<span class=\"grey\">#{format_date( @todo.completed_at )}</span>"
elsif @todo.pending?
"<a title='Depends on: #{@todo.predecessors.map(&:description).join(', ')}'><span class=\"orange\">Pending</span></a> "
elsif @todo.deferred?
show_date( @todo.show_from )
else
@ -96,6 +98,15 @@ module TodosHelper
end
end
def successors_span
unless @todo.successors.empty?
successors_count = @todo.successors.length
title = "Has #{pluralize(successors_count, 'pending action')}: #{@todo.successors.map(&:description).join(', ')}"
link_to(image_tag( 'blank.png', :width=>'10', :height=>'16', :border=>'0' ),
'#', {:class => 'show_successors', :title => title})
end
end
def tag_list_text
@todo.tags.collect{|t| t.name}.join(', ')
end

View file

@ -24,12 +24,12 @@ parameters += "&_tag_name=#{@tag_name}" if @source_view == 'tag'
<div class="description<%= staleness_class( todo ) %>">
<%= date_span -%>
<span class="todo.descr"><%= h sanitize(todo.description) %></span>
<%= successors_span %>
<%= image_tag_for_recurring_todo(todo) if @todo.from_recurring_todo? %>
<%= tag_list %>
<%= deferred_due_date %>
<%= project_and_context_links( parent_container_type, :suppress_context => suppress_context, :suppress_project => suppress_project ) %>
<%= render(:partial => "todos/toggle_notes", :locals => { :item => todo }) if todo.notes? %>
<%= render(:partial => "todos/toggle_dependencies", :locals => { :item => todo }) if todo.uncompleted_predecessors.empty? or !todo.successors.empty? %>
</div>
</div>
<div id="<%= dom_id(todo, 'edit') %>" class="edit-form" style="display:none">

View file

@ -1,5 +0,0 @@
<%= link_to(image_tag( 'blank.png', :width=>'16', :height=>'16', :border=>'0' ), "#", {:class => 'show_dependencies', :title => 'Show dependencies'}) %>
<div class="todo_dependencies" id="<%= dom_id(item, 'dependencies') %>" style="display:none">
<p>Links</p>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View file

@ -247,7 +247,7 @@ $(document).ready(function() {
$(this).next().toggle("fast"); return false;
});
$(".show_dependencies").live('click', function () {
$(".show_successors").live('click', function () {
$(this).next().toggle("fast"); return false;
});

View file

@ -99,8 +99,8 @@ a.to_bottom:hover {background: transparent url(/images/bottom_on.png) no-repeat;
a.show_notes, a.link_to_notes {background-image: url(/images/notes_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
a.show_notes:hover, a.link_to_notes:hover {background-image: url(/images/notes_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
a.show_dependencies, a.link_to_dependencies {background-image: url(/images/notes_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
a.show_dependencies:hover, a.link_to_dependencies:hover {background-image: url(/images/notes_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
a.show_successors, a.link_to_successors {background-image: url(/images/successor_off.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
a.show_successors:hover, a.link_to_successors:hover {background-image: url(/images/successor_on.png); background-repeat: no-repeat; padding: 1px; background-color: transparent;}
/* Structural divs */