Optimized ActiveRecord calls to minimize SQL queries, especially on the home page. Also, moved feed page to feed controller.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@294 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-07-28 06:55:35 +00:00
parent afaf2235fa
commit e0e407d99a
30 changed files with 151 additions and 115 deletions

View file

@ -72,4 +72,19 @@ class ApplicationController < ActionController::Base
@admin = User.find(:first, :conditions => [ "is_admin = ?", true ])
end
def init_data_for_sidebar
@projects = @user.projects
@contexts = @user.contexts
init_not_done_counts
end
def init_not_done_counts
@project_not_done_counts = Todo.count(:todo,
:conditions => ['todos.user_id = ? and todos.type = ? and todos.done = ?', @user.id, "Immediate", false],
:group => :project_id)
@context_not_done_counts = Todo.count(:todo,
:conditions => ['todos.user_id = ? and todos.type = ? and todos.done = ?', @user.id, "Immediate", false],
:group => :context_id)
end
end

View file

@ -27,6 +27,7 @@ class ContextController < ApplicationController
#
def show
init
check_user_set_context
init_todos
@on_page = "context"
@page_title = "TRACKS::Context: #{@context.name}"
@ -219,13 +220,14 @@ class ContextController < ApplicationController
@contexts = @user.contexts
@todos = @user.todos
@done = Todo.find(:all, :conditions => ["todos.user_id = ? and todos.done = ?", @user.id, true], :include => [:project], :order => "completed DESC")
init_not_done_counts
end
def init_todos
check_user_set_context
@done = @context.done_todos
@not_done = @context.not_done_todos
@count = @not_done.size
@not_done_todos = @context.not_done_todos
@count = @not_done_todos.size
end
end

View file

@ -12,6 +12,7 @@ class DeferredController < ApplicationController
def index
init_projects_and_contexts
init_not_done_counts
@page_title = "TRACKS::Tickler"
@tickles = @user.todos.find(:all, :conditions => ['type = ?', "Deferred"], :order => "show_from ASC")
@count = @tickles.size

View file

@ -4,11 +4,16 @@ class FeedController < ApplicationController
helper :feed
model :todo, :context, :project
session :disabled => true # Prevents session control from interfering with feed
session :disabled => true, :except => 'index' # Prevents session control from interfering with feed
before_filter :check_token_against_user_word
before_filter :check_token_against_user_word, :except => 'index'
prepend_before_filter :login_required, :only => 'index'
def index
@page_title = 'TRACKS::Feeds'
init_data_for_sidebar
render :layout => 'standard'
end
# Build an RSS feed

View file

@ -252,6 +252,7 @@ class ProjectController < ApplicationController
@contexts = @user.contexts
@todos = @user.todos
@done = Todo.find(:all, :conditions => ["todos.user_id = ? and todos.done = ?", @user.id, true], :include => [:project], :order => "completed DESC")
init_not_done_counts
end
def init_todos

View file

@ -14,14 +14,24 @@ class TodoController < ApplicationController
# Number of completed actions to show is determined by a setting in settings.yml
def index
self.init
@projects = @user.projects.find(:all, :include => [ :todos ])
@contexts = @user.contexts.find(:all, :include => [ :todos ])
@on_page = "home"
@page_title = "TRACKS::List tasks"
# If you've set no_completed to zero, the completed items box
# isn't shown on the home page
max_completed = @user.preferences["no_completed"].to_i-1
@done = (max_completed > 0) ? @done[0..max_completed] : nil
@done = nil
if max_completed > 0
@done = Todo.find(:all,
:conditions => ['todos.user_id = ? and todos.done = ?', @user.id, true],
:order => 'todos.completed DESC',
:limit => max_completed,
:include => [ :project, :context ])
end
@contexts_to_show = @contexts.reject {|x| x.hide? }
if @contexts.empty?
@ -37,10 +47,6 @@ class TodoController < ApplicationController
end
end
# Is this used? Seems like it should be deleted. -lukemelia, 2006-07-16
def update_element
end
# Called by a form button
# Parameters from form fields are passed to create new action
# in the selected context.
@ -58,14 +64,15 @@ class TodoController < ApplicationController
@saved = @item.save
if @saved
init_todos
@up_count = @todos.reject { |x| x.done? or x.context.hide? }.size.to_s
end
respond_to do |wants|
wants.html { redirect_to :action => "index" }
wants.js
wants.js do
if @saved
init_todos
@up_count = @todos.reject { |x| x.done? or x.context.hide? }.size.to_s
end
render
end
wants.xml { render :xml => @item.to_xml( :root => 'todo', :except => :user_id ) }
end
@ -215,11 +222,13 @@ class TodoController < ApplicationController
self.init
@page_title = "TRACKS::Completed tasks"
unless @done.nil?
@done_today = @done.collect { |x| x.completed >= 1.day.ago ? x:nil }.compact
@done_this_week = @done.collect { |x| 1.week.ago <= x.completed ? x:nil }.compact
@done_this_month = @done.collect { |x| 4.week.ago <= x.completed ? x:nil }.compact
end
@done = Todo.find(:all,
:conditions => ['todos.user_id = ? and todos.done = ? and todos.completed is not null', @user.id, true],
:order => 'todos.completed DESC',
:include => [ :project, :context ])
@done_today = @done.collect { |x| x.completed >= 1.day.ago ? x:nil }.compact
@done_this_week = @done.collect { |x| 1.week.ago <= x.completed ? x:nil }.compact
@done_this_month = @done.collect { |x| 4.week.ago <= x.completed ? x:nil }.compact
end
# Archived completed items, older than 28 days
@ -227,14 +236,13 @@ class TodoController < ApplicationController
def completed_archive
self.init
@page_title = "TRACKS::Archived completed tasks"
@done = Todo.find(:all,
:conditions => ['todos.user_id = ? and todos.done = ? and todos.completed is not null', @user.id, true],
:order => 'todos.completed DESC',
:include => [ :project, :context ])
@done_archive = @done.collect { |x| 28.day.ago > x.completed ? x:nil }.compact
end
def feeds
self.init
@page_title = "TRACKS::Feeds"
end
protected
def check_user_return_item
@ -251,11 +259,18 @@ class TodoController < ApplicationController
@projects = @user.projects
@contexts = @user.contexts
init_todos
init_not_done_counts
end
def init_todos
@todos = Todo.find(:all, :conditions => ['user_id = ? and type = ?', @user.id, "Immediate"])
@done = Todo.find(:all, :conditions => ['user_id = ? and done = ?', @user.id, true], :order => 'completed DESC')
@todos = Todo.find(:all,
:conditions => ['todos.user_id = ? and todos.type = ?', @user.id, "Immediate"],
:include => [ :project, :context ])
@not_done_todos = Todo.find(:all,
:conditions => ['todos.user_id = ? and todos.type = ? and todos.done = ?', @user.id, "Immediate", false],
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC",
:include => [ :project, :context ])
end
end

View file

@ -112,4 +112,21 @@ module ApplicationHelper
end
end
# Returns a count of next actions in the given context or project
# The result is count and a string descriptor, correctly pluralised if there are no
# actions or multiple actions
#
def count_undone_todos(todos_parent, string="actions")
count = eval "@#{todos_parent.class.to_s.downcase}_not_done_counts[#{todos_parent.id}]"
count = 0 if count == nil
#count = todos_parent.todos.select{|t| !t.done }.size
if count == 1
word = string.singularize
else
word = string.pluralize
end
return count.to_s + " " + word
end
end

View file

@ -37,7 +37,7 @@ module FeedHelper
result_string << "\n" + p.name.upcase + "\n"
result_string << p.description + "\n" if p.description_present?
result_string << "#{p.count_undone_todos}. Project is #{p.done? ? 'Done' : 'Active'}.\n"
result_string << "#{count_undone_todos(p)}. Project is #{p.done? ? 'Done' : 'Active'}.\n"
result_string << "#{p.linkurl}\n" if p.linkurl_present?
result_string << "\n"
end
@ -50,7 +50,7 @@ module FeedHelper
contexts.each do |c|
result_string << "\n" + c.name.upcase + "\n"
result_string << "#{c.count_undone_todos}. Context is #{c.hidden? ? 'Hidden' : 'Active'}.\n"
result_string << "#{count_undone_todos(c)}. Context is #{c.hidden? ? 'Hidden' : 'Active'}.\n"
result_string << "\n"
end
@ -62,4 +62,24 @@ module FeedHelper
joined_notes = split_notes.join("\\n")
end
def rss_feed_link(options = {})
image_tag = image_tag("feed-icon", :size => "16X16", :border => 0, :class => "rss-icon")
linkoptions = {:controller => 'feed', :action => 'rss', :name => "#{@user.login}", :token => "#{@user.word}"}
linkoptions.merge!(options)
link_to(image_tag, linkoptions, :title => "RSS feed")
end
def text_feed_link(options = {})
linkoptions = {:controller => 'feed', :action => 'text', :name => "#{@user.login}", :token => "#{@user.word}"}
linkoptions.merge!(options)
link_to('<span class="feed">TXT</span>', linkoptions, :title => "Plain text feed" )
end
def ical_feed_link(options = {})
linkoptions = {:controller => 'feed', :action => 'ical', :name => "#{@user.login}", :token => "#{@user.word}"}
linkoptions.merge!(options)
link_to('<span class="feed">iCal</span>', linkoptions, :title => "iCal feed")
end
end

View file

@ -111,24 +111,5 @@ module TodoHelper
str << ",step:1,inputField:\"" + input_field + "\",cache:true,align:\"TR\" })\n"
javascript_tag str
end
def rss_feed_link(options = {})
image_tag = image_tag("feed-icon", :size => "16X16", :border => 0, :class => "rss-icon")
linkoptions = {:controller => 'feed', :action => 'rss', :name => "#{@user.login}", :token => "#{@user.word}"}
linkoptions.merge!(options)
link_to(image_tag, linkoptions, :title => "RSS feed")
end
def text_feed_link(options = {})
linkoptions = {:controller => 'feed', :action => 'text', :name => "#{@user.login}", :token => "#{@user.word}"}
linkoptions.merge!(options)
link_to('<span class="feed">TXT</span>', linkoptions, :title => "Plain text feed" )
end
def ical_feed_link(options = {})
linkoptions = {:controller => 'feed', :action => 'ical', :name => "#{@user.login}", :token => "#{@user.word}"}
linkoptions.merge!(options)
link_to('<span class="feed">iCal</span>', linkoptions, :title => "iCal feed")
end
end

View file

@ -24,32 +24,20 @@ class Context < ActiveRecord::Base
end
def find_not_done_todos
todos = Todo.find :all, :conditions => ["todos.context_id = ? AND todos.done = ? AND type = ?", id, false, "Immediate"],
:include => [:context, :project],
:order => "due IS NULL, due ASC, created_at ASC"
todos = Todo.find(:all,
:conditions => ['todos.context_id = ? and todos.type = ? and todos.done = ?', id, "Immediate", false],
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC",
:include => [ :project, :context ])
end
def find_done_todos
todos = Todo.find :all, :conditions => ["todos.context_id = ? AND todos.done = ? AND type = ?", id, true, "Immediate"],
:include => [:context, :project],
todos = Todo.find :all, :conditions => ["todos.context_id = ? AND todos.type = ? AND todos.done = ?", id, "Immediate", true],
:order => "completed DESC",
:include => [:context, :project],
:limit => @user.preferences["no_completed"].to_i
end
# Returns a count of next actions in the given context
# The result is count and a string descriptor, correctly pluralised if there are no
# actions or multiple actions
#
def count_undone_todos(string="actions")
count = self.not_done_todos.size
if count == 1
word = string.singularize
else
word = string.pluralize
end
return count.to_s + " " + word
end
def hidden?
self.hide == true
end

View file

@ -33,28 +33,19 @@ class Project < ActiveRecord::Base
end
def find_not_done_todos
Todo.find :all, :conditions => ["project_id = ? AND done = ?", id, false],
:order => "due IS NULL, due ASC, created_at ASC"
todos = Todo.find(:all,
:conditions => ['todos.project_id = ? and todos.type = ? and todos.done = ?', id, "Immediate", false],
:order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC",
:include => [ :project, :context ])
end
def find_done_todos
Todo.find :all, :conditions => ["project_id = ? AND done = ?", id, true],
:order => "completed DESC",
:limit => @user.preferences["no_completed"].to_i
todos = Todo.find :all, :conditions => ["todos.project_id = ? AND todos.type = ? AND todos.done = ?", id, "Immediate", true],
:order => "completed DESC",
:include => [:context, :project],
:limit => @user.preferences["no_completed"].to_i
end
# Returns a count of next actions in the given project
# The result is count and a string descriptor, correctly pluralised if there are no
# actions or multiple actions
#
def count_undone_todos(string="actions")
count = not_done_todos.size
if count == 1
word = string.singularize
else
word = string.pluralize
end
return count.to_s + " " + word
end
end

View file

@ -1,4 +1,4 @@
<% @not_done = context.not_done_todos %>
<% @not_done = @not_done_todos.select {|t| t.context_id == context.id } %>
<div id="c<%= context.id %>" class="container context" <%= "style=\"display:none\"" if collapsible && @not_done.empty? %>>
<h2>
<% if collapsible -%>
@ -10,6 +10,6 @@
<div id="c<%= context.id %>empty-nd" style="display:<%= @not_done.empty? ? 'block' : 'none'%>;">
<div class="message"><p>Currently there are no uncompleted actions in this context</p></div>
</div>
<%= render :partial => "todo/item", :collection => @not_done %>
<%= render :partial => "todo/item", :collection => @not_done, :locals => { :parent_container_type => "context" } %>
</div><!-- [end:items] -->
</div><!-- [end:c<%= context.id %>] -->

View file

@ -7,7 +7,7 @@
</div>
<div class="data">
<%= link_to( sanitize("#{context.name}"), :action => "show", :name => urlize(context.name) ) %>
<%= " (" + context.count_undone_todos("actions") + ")" %>
<%= " (" + count_undone_todos(context,"actions") + ")" %>
</div>
<div class="buttons">

View file

@ -5,7 +5,7 @@ if @saved
page['badge_count'].replace_html @up_count
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
page.send :record, "Form.reset('todo-form-new-action-lightbox');Form.focusFirstElement('todo-form-new-action-lightbox')"
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item', :locals => { :parent_container_type => "context" }
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
page["c#{@item.context_id}empty-nd"].hide # If we are adding an new action, the uncompleted actions must be > 0
else

View file

@ -3,7 +3,7 @@ if @saved
if @item.done?
# Don't try to insert contents into a non-existent container!
unless @user.preferences["no_completed"].to_i == 0
page.insert_html :top, "completed", :partial => 'todo/item'
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "completed" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
if @down_count == '0'
page["c#{@item.context_id}empty-nd"].show
@ -12,7 +12,7 @@ if @saved
end
else
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}"
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item', :locals => { :parent_container_type => "context" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
if @done_count == '0'
page.show "empty-d"

View file

@ -9,7 +9,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
xml.title(c.name)
xml.link(url_for(:only_path => false, :controller => 'context', :action => 'show', :name => urlize(c.name)))
context_description = ''
context_description += "<p>#{c.count_undone_todos}. "
context_description += "<p>#{count_undone_todos(c)}. "
context_description += "Context is #{c.hidden? ? 'Hidden' : 'Active'}. "
context_description += "</p>"
xml.description(context_description)

View file

@ -10,7 +10,7 @@ xml.rss("version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/") do
xml.link(url_for(:only_path => false, :controller => 'project', :action => 'show', :name => urlize(p.name)))
project_description = ''
project_description += sanitize(markdown( p.description )) if p.description_present?
project_description += "<p>#{p.count_undone_todos}. "
project_description += "<p>#{count_undone_todos(p)}. "
project_description += "Project is #{p.done? ? 'Done' : 'Active'}. "
project_description += "<a href=\"#{p.linkurl}\">#{p.linkurl}</a>" if p.linkurl_present?
project_description += "</p>"

View file

@ -50,7 +50,7 @@
<li><%= navigation_link( "Done", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %></li>
<li><%= navigation_link( "Notes", {:controller => "note", :action => "index"}, {:accesskey => "o", :title => "Show all notes"} ) %></li>
<li><%= navigation_link( "Preferences", {:controller => "user", :action => "preferences"}, {:accesskey => "u", :title => "Show my preferences"} ) %></li>
<li><%= navigation_link(image_tag("feed-icon", :size => "16X16", :border => 0), {:controller => "todo", :action => "feeds"}, :title => "See a list of available feeds" ) %></li>
<li><%= navigation_link(image_tag("feed-icon", :size => "16X16", :border => 0), {:controller => "feed", :action => "index"}, :title => "See a list of available feeds" ) %></li>
</ul>
</div>
</div>

View file

@ -18,6 +18,6 @@
<div id="p<%= project.id %>empty-nd" style="display:<%= @not_done.empty? ? 'block' : 'none'%>;">
<div class="message"><p>Currently there are no uncompleted actions in this project</p></div>
</div>
<%= render :partial => "todo/item", :collection => @not_done %>
<%= render :partial => "todo/item", :collection => @not_done, :locals => { :parent_container_type => "project" } %>
</div><!-- [end:items] -->
</div><!-- [end:p<%= project.id %>] -->

View file

@ -6,7 +6,7 @@
<span class="handle">DRAG</span>
</div>
<div class="data">
<%= link_to( sanitize("#{project.name}"), :action => "show", :name => urlize(project.name) ) %><%= " (" + project.count_undone_todos("actions") + ")" %>
<%= link_to( sanitize("#{project.name}"), :action => "show", :name => urlize(project.name) ) %><%= " (" + count_undone_todos(project,"actions") + ")" %>
</div>
<div class="buttons">
<% if project.done? -%>

View file

@ -5,7 +5,7 @@ if @saved
page['badge_count'].replace_html @up_count
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
page.send :record, "Form.reset('todo-form-new-action-lightbox');Form.focusFirstElement('todo-form-new-action-lightbox')"
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item'
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item', :locals => { :parent_container_type => "project" }
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
page.hide "p#{@item.project_id}empty-nd" # If we are adding an new action, the uncompleted actions must be > 0
else

View file

@ -3,7 +3,7 @@ if @saved
if @item.done?
# Don't try to insert contents into a non-existent container!
unless @user.preferences["no_completed"].to_i == 0
page.insert_html :top, "completed", :partial => 'todo/item'
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "project" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
if @down_count == '0'
page["p#{@item.project_id}empty-nd"].show
@ -12,7 +12,7 @@ if @saved
end
else
page.call "todoItems.ensureVisibleWithEffectAppear", "p#{@item.project_id}"
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item'
page.insert_html :bottom, "p#{@item.project_id}", :partial => 'todo/item', :locals => { :parent_container_type => "project" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
if @done_count == '0'
page.show "empty-d"

View file

@ -2,7 +2,7 @@
<ul>
<% for project in @projects.reject{|p| p.done? } -%>
<li id="sidebar-project-<%= project.id %>" class="sidebar-project"><%= link_to( sanitize(project.name), { :controller => "project", :action => "show",
:name => urlize(project.name) } ) + " (" + project.count_undone_todos("actions") + ")" %></li>
:name => urlize(project.name) } ) + " (" + count_undone_todos(project,"actions") + ")" %></li>
<% end -%>
</ul>
@ -10,7 +10,7 @@
<ul>
<% for project in @projects.reject{|p| !p.done? } -%>
<li id="sidebar-project-<%= project.id %>" class="sidebar-project"><%= link_to( sanitize(project.name), { :controller => "project", :action => "show",
:name => urlize(project.name) } ) + " (" + project.count_undone_todos("actions") + ")" %></li>
:name => urlize(project.name) } ) + " (" + count_undone_todos(project,"actions") + ")" %></li>
<% end -%>
</ul>
@ -18,7 +18,7 @@
<ul>
<% for context in @contexts.reject{|c| c.hide? } -%>
<li id="sidebar-context-<%= context.id %>" class="sidebar-context"><%= link_to( sanitize(context.name), { :controller => "context", :action => "show",
:name => urlize(context.name) } ) + " (" + context.count_undone_todos("actions") + ")" %></li>
:name => urlize(context.name) } ) + " (" + count_undone_todos(context,"actions") + ")" %></li>
<% end -%>
</ul>
@ -26,6 +26,6 @@
<ul>
<% for context in @contexts.reject{|c| !c.hide? } -%>
<li id="sidebar-context-<%= context.id %>" class="sidebar-context"><%= link_to( sanitize(context.name), { :controller => "context", :action => "show",
:name => urlize(context.name) } ) + " (" + context.count_undone_todos("actions") + ")" %></li>
:name => urlize(context.name) } ) + " (" + count_undone_todos(context,"actions") + ")" %></li>
<% end -%>
</ul>

View file

@ -12,6 +12,6 @@
<div class="message"><p>Currently there are no completed actions <%= append_descriptor %></p></div>
</div>
<%= render :partial => "todo/item", :collection => done %>
<%= render :partial => "todo/item", :collection => done, :locals => { :parent_container_type => "completed" } %>
</div>
</div><!-- [end:next_actions] -->

View file

@ -16,7 +16,7 @@
<% if item.done? -%>
(<%= item.context.name %><%= ", " + item.project.name if item.project_id %>)
<% else -%>
<% if @on_page == "project" -%>
<% if parent_container_type == "project" -%>
<%= link_to( "[C]", { :controller => "context", :action => "show", :name => urlize(item.context.name) }, :title => "View context: #{item.context.name}" ) %>
<% elsif item.project_id -%>
<%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %>

View file

@ -6,7 +6,7 @@ if @saved
page.send :record, "Form.reset('todo-form-new-action');Form.focusFirstElement('todo-form-new-action')"
page.send :record, "Form.reset('todo-form-new-action-lightbox');Form.focusFirstElement('todo-form-new-action-lightbox')"
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}"
page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todo/item'
page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todo/item', :locals => { :parent_container_type => "context" }
page.visual_effect :highlight, "item-#{@item.id}-container", :duration => 3
page["c#{@item.context_id}empty-nd"].hide
else

View file

@ -6,7 +6,7 @@ if @saved
if @item.done?
# Don't try to insert contents into a non-existent container!
unless @user.preferences["no_completed"].to_i == 0
page.insert_html :top, "completed", :partial => 'todo/item'
page.insert_html :top, "completed", :partial => 'todo/item', :locals => { :parent_container_type => "completed" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
end
if @remaining_undone_in_context == 0
@ -14,7 +14,7 @@ if @saved
end
else
page.call "todoItems.ensureVisibleWithEffectAppear", "c#{@item.context_id}"
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item'
page.insert_html :bottom, "c#{@item.context_id}", :partial => 'todo/item', :locals => { :parent_container_type => "context" }
page.visual_effect :highlight, "item-#{@item.id}", {'startcolor' => "'#99ff99'"}
end
page.hide "status"

View file

@ -2,12 +2,12 @@ page.hide "info"
if @saved
item_container_id = "item-#{@item.id}-container"
if @item.context_id == @original_item_context_id
page.replace item_container_id, :partial => 'todo/item'
page.replace item_container_id, :partial => 'todo/item', :locals => { :parent_container_type => "context" }
page.visual_effect :highlight, item_container_id, :duration => 3
else
page[item_container_id].remove
page.call "todoItems.expandNextActionListingByContext", "c#{@item.context_id}items", true
page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todo/item'
page.insert_html :bottom, "c#{@item.context_id}items", :partial => 'todo/item', :locals => { :parent_container_type => "context" }
page.delay(0.5) do
page.call "todoItems.ensureContainerHeight", "c#{@original_item_context_id}items"
page.call "todoItems.ensureContainerHeight", "c#{@item.context_id}items"

View file

@ -64,7 +64,7 @@ ActionController::Routing::Routes.draw do |map|
map.connect 'notes', :controller => 'note', :action => 'index'
# Feed Routes
map.connect 'feeds', :controller => 'todo', :action => 'feeds'
map.connect 'feeds', :controller => 'feed', :action => 'index'
map.connect 'feed/:action/:name/:token', :controller => 'feed'
# Install the default route as the lowest priority.