From ee3057185540408b54ed016712805fe08eba4956 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Sat, 29 Nov 2008 20:32:39 +0100 Subject: [PATCH] fix #793 where the feed title is given more information about the content also fixes project feed where the link in the feed points to the context of the todo instead of the project --- app/controllers/todos_controller.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/controllers/todos_controller.rb b/app/controllers/todos_controller.rb index 265fcea3..6038f3f3 100644 --- a/app/controllers/todos_controller.rb +++ b/app/controllers/todos_controller.rb @@ -536,13 +536,17 @@ class TodosController < ApplicationController end def with_parent_resource_scope(&block) + @feed_title = "Actions " if (params[:context_id]) @context = current_user.contexts.find_by_params(params) + @feed_title = @feed_title + "in context '#{@context.name}'" Todo.send :with_scope, :find => {:conditions => ['todos.context_id = ?', @context.id]} do yield end elsif (params[:project_id]) @project = current_user.projects.find_by_params(params) + @feed_title = @feed_title + "in project '#{@project.name}'" + @project_feed = true Todo.send :with_scope, :find => {:conditions => ['todos.project_id = ?', @project.id]} do yield end @@ -718,7 +722,7 @@ class TodosController < ApplicationController render_rss_feed_for @todos, :feed => todo_feed_options, :item => { :title => :description, - :link => lambda { |t| context_url(t.context) }, + :link => lambda { |t| @project_feed.nil? ? context_url(t.context) : project_url(t.project) }, :guid => lambda { |t| todo_url(t) }, :description => todo_feed_content } @@ -726,7 +730,9 @@ class TodosController < ApplicationController end def todo_feed_options - Todo.feed_options(current_user) + options = Todo.feed_options(current_user) + options[:title] = @feed_title + return options end def todo_feed_content