From 5659b8adbb321311673611c53bf4af9de0f73c82 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Sat, 29 Nov 2008 20:15:49 +0100 Subject: [PATCH 1/2] fix #764 where unnecessary space is removed in the recurrence pattern also fixes the case that a rec todo that has a start date but no end date is not showing the from xx-xx-xxxx on the page --- app/helpers/recurring_todos_helper.rb | 10 +++++----- app/views/recurring_todos/_recurring_todo.html.erb | 11 ++++++++++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/app/helpers/recurring_todos_helper.rb b/app/helpers/recurring_todos_helper.rb index b346e7ea..76fcc95e 100644 --- a/app/helpers/recurring_todos_helper.rb +++ b/app/helpers/recurring_todos_helper.rb @@ -3,7 +3,7 @@ module RecurringTodosHelper def recurrence_time_span(rt) case rt.ends_on when "no_end_date" - return "" + return rt.start_from.nil? ? "" : "from " + format_date(rt.start_from) when "ends_on_number_of_times" return "for "+rt.number_of_occurences.to_s + " times" when "ends_on_end_date" @@ -11,7 +11,7 @@ module RecurringTodosHelper ends = rt.end_date.nil? ? "" : " until " + format_date(rt.end_date) return starts+ends else - raise Exception.new, "unknown recurrence time span selection (#{self.ends_on})" + raise Exception.new, "unknown recurrence time span selection (#{self.ends_on})" end end @@ -28,10 +28,10 @@ module RecurringTodosHelper def recurring_todo_tag_list tags_except_starred = @recurring_todo.tags.reject{|t| t.name == Todo::STARRED_TAG_NAME} - tag_list = tags_except_starred.collect{|t| "" + + tag_list = tags_except_starred.collect{|t| "" + # link_to(t.name, :controller => "todos", :action => "tag", :id => # t.name) + TODO: tag view for recurring_todos (yet?) - t.name + + t.name + ""}.join('') "#{tag_list}" end @@ -44,7 +44,7 @@ module RecurringTodosHelper str end - def recurring_todo_remote_star_icon + def recurring_todo_remote_star_icon str = link_to( image_tag_for_star(@recurring_todo), toggle_star_recurring_todo_path(@recurring_todo), :class => "icon star_item", :title => "star the action '#{@recurring_todo.description}'") diff --git a/app/views/recurring_todos/_recurring_todo.html.erb b/app/views/recurring_todos/_recurring_todo.html.erb index 3962b27b..ccc93cbb 100644 --- a/app/views/recurring_todos/_recurring_todo.html.erb +++ b/app/views/recurring_todos/_recurring_todo.html.erb @@ -6,7 +6,16 @@
<%= sanitize(recurring_todo.description) %> <%= recurring_todo_tag_list %> - [<%=recurrence_target(recurring_todo)%> <%= recurring_todo.recurrence_pattern %> <%= recurrence_time_span(recurring_todo) %>] + <% + rt = recurrence_target(recurring_todo) + rp = recurring_todo.recurrence_pattern + # only add space if recurrence_pattern has content + rp = " " + rp if !rp.nil? + rts = recurrence_time_span(recurring_todo) + # only add space if recurrence_time_span has content + rts = " " + rts if !(rts == "") + %> + [<%=rt%><%=rp%><%=rts%>]
From ee3057185540408b54ed016712805fe08eba4956 Mon Sep 17 00:00:00 2001 From: Reinier Balt Date: Sat, 29 Nov 2008 20:32:39 +0100 Subject: [PATCH 2/2] 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