diff --git a/tracks/app/controllers/application.rb b/tracks/app/controllers/application.rb index 38ac8fc4..5454540d 100644 --- a/tracks/app/controllers/application.rb +++ b/tracks/app/controllers/application.rb @@ -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 diff --git a/tracks/app/controllers/context_controller.rb b/tracks/app/controllers/context_controller.rb index 09391a0d..03099719 100644 --- a/tracks/app/controllers/context_controller.rb +++ b/tracks/app/controllers/context_controller.rb @@ -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 diff --git a/tracks/app/controllers/deferred_controller.rb b/tracks/app/controllers/deferred_controller.rb index b7b20e0a..b1822728 100644 --- a/tracks/app/controllers/deferred_controller.rb +++ b/tracks/app/controllers/deferred_controller.rb @@ -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 diff --git a/tracks/app/controllers/feed_controller.rb b/tracks/app/controllers/feed_controller.rb index aebf2158..93a8d5b2 100644 --- a/tracks/app/controllers/feed_controller.rb +++ b/tracks/app/controllers/feed_controller.rb @@ -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 diff --git a/tracks/app/controllers/project_controller.rb b/tracks/app/controllers/project_controller.rb index 1b65b1d3..2df5c008 100644 --- a/tracks/app/controllers/project_controller.rb +++ b/tracks/app/controllers/project_controller.rb @@ -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 diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index a9be5427..b1d5e098 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -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 diff --git a/tracks/app/helpers/application_helper.rb b/tracks/app/helpers/application_helper.rb index cd12a99f..ce213884 100644 --- a/tracks/app/helpers/application_helper.rb +++ b/tracks/app/helpers/application_helper.rb @@ -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 diff --git a/tracks/app/helpers/feed_helper.rb b/tracks/app/helpers/feed_helper.rb index 345d9fe2..6bdc4a5e 100644 --- a/tracks/app/helpers/feed_helper.rb +++ b/tracks/app/helpers/feed_helper.rb @@ -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('TXT', 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('iCal', linkoptions, :title => "iCal feed") + end + + end diff --git a/tracks/app/helpers/todo_helper.rb b/tracks/app/helpers/todo_helper.rb index ed8316a2..6bc0dba3 100644 --- a/tracks/app/helpers/todo_helper.rb +++ b/tracks/app/helpers/todo_helper.rb @@ -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('TXT', 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('iCal', linkoptions, :title => "iCal feed") - end - + end diff --git a/tracks/app/models/context.rb b/tracks/app/models/context.rb index a332c0aa..c8e47368 100644 --- a/tracks/app/models/context.rb +++ b/tracks/app/models/context.rb @@ -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 diff --git a/tracks/app/models/project.rb b/tracks/app/models/project.rb index 754427a5..d080c9c7 100644 --- a/tracks/app/models/project.rb +++ b/tracks/app/models/project.rb @@ -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 diff --git a/tracks/app/views/context/_context.rhtml b/tracks/app/views/context/_context.rhtml index 18bcc5f0..1f4a9691 100644 --- a/tracks/app/views/context/_context.rhtml +++ b/tracks/app/views/context/_context.rhtml @@ -1,4 +1,4 @@ -<% @not_done = context.not_done_todos %> +<% @not_done = @not_done_todos.select {|t| t.context_id == context.id } %>
>

<% if collapsible -%> @@ -10,6 +10,6 @@

Currently there are no uncompleted actions in this context

-<%= render :partial => "todo/item", :collection => @not_done %> +<%= render :partial => "todo/item", :collection => @not_done, :locals => { :parent_container_type => "context" } %>

diff --git a/tracks/app/views/context/_context_listing.rhtml b/tracks/app/views/context/_context_listing.rhtml index 98484c90..4dc2ae50 100644 --- a/tracks/app/views/context/_context_listing.rhtml +++ b/tracks/app/views/context/_context_listing.rhtml @@ -7,7 +7,7 @@
<%= link_to( sanitize("#{context.name}"), :action => "show", :name => urlize(context.name) ) %> - <%= " (" + context.count_undone_todos("actions") + ")" %> + <%= " (" + count_undone_todos(context,"actions") + ")" %>
diff --git a/tracks/app/views/context/add_item.rjs b/tracks/app/views/context/add_item.rjs index baee2e33..c7abbb11 100644 --- a/tracks/app/views/context/add_item.rjs +++ b/tracks/app/views/context/add_item.rjs @@ -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 diff --git a/tracks/app/views/context/toggle_check.rjs b/tracks/app/views/context/toggle_check.rjs index 8c1e71b8..b20725d8 100644 --- a/tracks/app/views/context/toggle_check.rjs +++ b/tracks/app/views/context/toggle_check.rjs @@ -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" diff --git a/tracks/app/views/feed/contexts_rss.rxml b/tracks/app/views/feed/contexts_rss.rxml index a595f36e..37a94a7c 100644 --- a/tracks/app/views/feed/contexts_rss.rxml +++ b/tracks/app/views/feed/contexts_rss.rxml @@ -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 += "

#{c.count_undone_todos}. " + context_description += "

#{count_undone_todos(c)}. " context_description += "Context is #{c.hidden? ? 'Hidden' : 'Active'}. " context_description += "

" xml.description(context_description) diff --git a/tracks/app/views/todo/feeds.rhtml b/tracks/app/views/feed/index.rhtml similarity index 100% rename from tracks/app/views/todo/feeds.rhtml rename to tracks/app/views/feed/index.rhtml diff --git a/tracks/app/views/feed/projects_rss.rxml b/tracks/app/views/feed/projects_rss.rxml index eec0f3b4..c2ebab22 100644 --- a/tracks/app/views/feed/projects_rss.rxml +++ b/tracks/app/views/feed/projects_rss.rxml @@ -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.count_undone_todos}. " + project_description += "

#{count_undone_todos(p)}. " project_description += "Project is #{p.done? ? 'Done' : 'Active'}. " project_description += "#{p.linkurl}" if p.linkurl_present? project_description += "

" diff --git a/tracks/app/views/layouts/standard.rhtml b/tracks/app/views/layouts/standard.rhtml index 217c5ed2..d7da25ea 100644 --- a/tracks/app/views/layouts/standard.rhtml +++ b/tracks/app/views/layouts/standard.rhtml @@ -50,7 +50,7 @@
  • <%= navigation_link( "Done", {:controller => "todo", :action => "completed"}, {:accesskey=>"d", :title=>"Completed"} ) %>
  • <%= navigation_link( "Notes", {:controller => "note", :action => "index"}, {:accesskey => "o", :title => "Show all notes"} ) %>
  • <%= navigation_link( "Preferences", {:controller => "user", :action => "preferences"}, {:accesskey => "u", :title => "Show my preferences"} ) %>
  • -
  • <%= navigation_link(image_tag("feed-icon", :size => "16X16", :border => 0), {:controller => "todo", :action => "feeds"}, :title => "See a list of available feeds" ) %>
  • +
  • <%= navigation_link(image_tag("feed-icon", :size => "16X16", :border => 0), {:controller => "feed", :action => "index"}, :title => "See a list of available feeds" ) %>
  • diff --git a/tracks/app/views/project/_project.rhtml b/tracks/app/views/project/_project.rhtml index b962c32d..c1e41be9 100644 --- a/tracks/app/views/project/_project.rhtml +++ b/tracks/app/views/project/_project.rhtml @@ -18,6 +18,6 @@

    Currently there are no uncompleted actions in this project

    - <%= render :partial => "todo/item", :collection => @not_done %> + <%= render :partial => "todo/item", :collection => @not_done, :locals => { :parent_container_type => "project" } %> diff --git a/tracks/app/views/project/_project_listing.rhtml b/tracks/app/views/project/_project_listing.rhtml index 6f500d9d..86ff8eac 100644 --- a/tracks/app/views/project/_project_listing.rhtml +++ b/tracks/app/views/project/_project_listing.rhtml @@ -6,7 +6,7 @@ DRAG
    - <%= 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") + ")" %>
    <% if project.done? -%> diff --git a/tracks/app/views/project/add_item.rjs b/tracks/app/views/project/add_item.rjs index aebc3549..c98ac2b8 100644 --- a/tracks/app/views/project/add_item.rjs +++ b/tracks/app/views/project/add_item.rjs @@ -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 diff --git a/tracks/app/views/project/toggle_check.rjs b/tracks/app/views/project/toggle_check.rjs index 64e51e6e..a898baba 100644 --- a/tracks/app/views/project/toggle_check.rjs +++ b/tracks/app/views/project/toggle_check.rjs @@ -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" diff --git a/tracks/app/views/shared/sidebar.rhtml b/tracks/app/views/shared/sidebar.rhtml index 963b0c8e..7dc07396 100644 --- a/tracks/app/views/shared/sidebar.rhtml +++ b/tracks/app/views/shared/sidebar.rhtml @@ -2,7 +2,7 @@ @@ -10,7 +10,7 @@ @@ -18,7 +18,7 @@ @@ -26,6 +26,6 @@ diff --git a/tracks/app/views/todo/_completed.rhtml b/tracks/app/views/todo/_completed.rhtml index db0df5b4..9743962d 100644 --- a/tracks/app/views/todo/_completed.rhtml +++ b/tracks/app/views/todo/_completed.rhtml @@ -12,6 +12,6 @@

    Currently there are no completed actions <%= append_descriptor %>

    - <%= render :partial => "todo/item", :collection => done %> + <%= render :partial => "todo/item", :collection => done, :locals => { :parent_container_type => "completed" } %> \ No newline at end of file diff --git a/tracks/app/views/todo/_item.rhtml b/tracks/app/views/todo/_item.rhtml index af57a86c..57a00353 100644 --- a/tracks/app/views/todo/_item.rhtml +++ b/tracks/app/views/todo/_item.rhtml @@ -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}" ) %> diff --git a/tracks/app/views/todo/add_item.rjs b/tracks/app/views/todo/add_item.rjs index c14683bf..8dcc2b05 100644 --- a/tracks/app/views/todo/add_item.rjs +++ b/tracks/app/views/todo/add_item.rjs @@ -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 diff --git a/tracks/app/views/todo/toggle_check.rjs b/tracks/app/views/todo/toggle_check.rjs index 07b78359..535e6312 100644 --- a/tracks/app/views/todo/toggle_check.rjs +++ b/tracks/app/views/todo/toggle_check.rjs @@ -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" diff --git a/tracks/app/views/todo/update_action.rjs b/tracks/app/views/todo/update_action.rjs index f08900e8..0f1cddd7 100644 --- a/tracks/app/views/todo/update_action.rjs +++ b/tracks/app/views/todo/update_action.rjs @@ -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" diff --git a/tracks/config/routes.rb b/tracks/config/routes.rb index 35ed5e73..95d6d5cd 100644 --- a/tracks/config/routes.rb +++ b/tracks/config/routes.rb @@ -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.