From 86b8753c17c253568d5a2eeaab9c1bab3327c696 Mon Sep 17 00:00:00 2001 From: bsag Date: Sun, 2 Oct 2005 10:35:07 +0000 Subject: [PATCH] I'm seriously beginning to hate #188, but it really is fixed now. Really. The problem before was that due to a weird conjunction of due dates and creation dates on my sample set, it did actually work for me. now I use the same bit of code to display the actions on the home page and on the txt page, so it really is the same. If anyone opens that ticket again, woe betide them... :-D Also fixes #109: lolindrath's patch (plus a bit of extra tinkering) means that newly created and newly edited actions get the [C] link if they are on the projects page and the [P] link otherwise. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@147 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/feed_controller.rb | 1 - tracks/app/controllers/todo_controller.rb | 4 ++-- tracks/app/helpers/feed_helper.rb | 4 +--- tracks/app/views/context/show.rhtml | 2 +- tracks/app/views/feed/na_text.rhtml | 7 ++++++- tracks/app/views/project/_show_items.rhtml | 1 + tracks/app/views/project/show.rhtml | 1 + tracks/app/views/todo/_item.rhtml | 10 ++++++++-- 8 files changed, 20 insertions(+), 10 deletions(-) diff --git a/tracks/app/controllers/feed_controller.rb b/tracks/app/controllers/feed_controller.rb index e90ce6ff..d464eeb1 100644 --- a/tracks/app/controllers/feed_controller.rb +++ b/tracks/app/controllers/feed_controller.rb @@ -29,7 +29,6 @@ class FeedController < ApplicationController # def na_text @contexts = @user.contexts.collect { |x| x.hide? ? nil:x }.compact.sort! { |x,y| x.position <=> y.position } - @not_done = @user.todos.collect { |x| x.done? ? nil:x }.compact.sort! {|x,y| x.created_at <=> y.created_at } @headers["Content-Type"] = "text/plain; charset=utf-8" end diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index 865e4f30..04179a68 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -71,7 +71,7 @@ class TodoController < ApplicationController end if item.save - render :partial => 'item', :object => item + render :partial => 'item', :object => item, :project => @params["project"] else flash["warning"] = "Couldn't add next action \"#{item.description}\"" render_text "" @@ -93,7 +93,7 @@ class TodoController < ApplicationController end if item.save - render :partial => 'item', :object => item + render :partial => 'item', :object => item, :project => @params["project"] else flash["warning"] = "Couldn't update the action" render_text "" diff --git a/tracks/app/helpers/feed_helper.rb b/tracks/app/helpers/feed_helper.rb index a46bad0c..28de48e1 100644 --- a/tracks/app/helpers/feed_helper.rb +++ b/tracks/app/helpers/feed_helper.rb @@ -5,9 +5,8 @@ module FeedHelper # indented underneath. If there is a due date # and the item is in a project, these are also displayed # - def build_text_page(list,contexts) + def build_text_page(list,context) result_string = "" - for context in contexts result_string << "\n" + context.name.upcase + ":\n" list.each do |item| @@ -27,7 +26,6 @@ module FeedHelper end end - end return result_string end diff --git a/tracks/app/views/context/show.rhtml b/tracks/app/views/context/show.rhtml index 78bfc8fb..e2b6ec7c 100644 --- a/tracks/app/views/context/show.rhtml +++ b/tracks/app/views/context/show.rhtml @@ -48,7 +48,7 @@
<%= text_area( "new_item", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2) %>

- <%= options_from_collection_for_select(@projects, "id", "name") %>
diff --git a/tracks/app/views/feed/na_text.rhtml b/tracks/app/views/feed/na_text.rhtml index 42f4f50e..d02dd48e 100644 --- a/tracks/app/views/feed/na_text.rhtml +++ b/tracks/app/views/feed/na_text.rhtml @@ -1 +1,6 @@ -<%= build_text_page( @not_done, @contexts ) %> +<% +for @context in @contexts + @not_done = @context.find_not_done_todos +-%> + <%= build_text_page( @not_done, @context ) %> +<% end -%> diff --git a/tracks/app/views/project/_show_items.rhtml b/tracks/app/views/project/_show_items.rhtml index 3b4fc9a7..4ac1b90b 100644 --- a/tracks/app/views/project/_show_items.rhtml +++ b/tracks/app/views/project/_show_items.rhtml @@ -51,6 +51,7 @@ :update => "item-#{item.id}-container", :complete => "new Effect.Appear('item-#{item.id}-container', true);" %> <%= render_partial 'todo/action_edit_form', item %> + <%= end_form_tag %> diff --git a/tracks/app/views/project/show.rhtml b/tracks/app/views/project/show.rhtml index 1de9b12b..aa68d749 100644 --- a/tracks/app/views/project/show.rhtml +++ b/tracks/app/views/project/show.rhtml @@ -86,6 +86,7 @@
<%= text_field("new_item", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 4) %>

+ <%= end_form_tag %> <%= calendar_setup( "new_item_due" ) %> diff --git a/tracks/app/views/todo/_item.rhtml b/tracks/app/views/todo/_item.rhtml index fc403599..c3ef0f56 100644 --- a/tracks/app/views/todo/_item.rhtml +++ b/tracks/app/views/todo/_item.rhtml @@ -16,9 +16,15 @@ <% end %> <%= due_date( item.due ) %> <%= sanitize(item.description) %> - <% if item.project_id %> - <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %> + + <% if @params["project"] == true %> + <%= link_to( "[C]", { :controller => "context", :action => "show", :name => urlize(item.context.name) }, :title => "View context: #{item.context.name}" ) %> + <% else %> + <% if item.project_id %> + <%= link_to( "[P]", { :controller => "project", :action => "show", :name => urlize(item.project.name) }, :title => "View project: #{item.project.name}" ) %> + <% end %> <% end %> + <% if item.notes? %> <%= toggle_show_notes( item ) %> <% end %>