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
This commit is contained in:
bsag 2005-10-02 10:35:07 +00:00
parent 1043fefb1b
commit 86b8753c17
8 changed files with 20 additions and 10 deletions

View file

@ -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

View file

@ -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 ""

View file

@ -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

View file

@ -48,7 +48,7 @@
<label for="new_item_notes">Notes</label><br />
<%= text_area( "new_item", "notes", "cols" => 25, "rows" => 10, "tabindex" => 2) %><br />
<label for="new_item_project_id">Project</label><br />
<select name="item[project_id]" id="item_project_id" tabindex="3">
<select name="new_item[project_id]" id="item_project_id" tabindex="3">
<option selected="selected"></option>
<%= options_from_collection_for_select(@projects, "id", "name") %>
</select><br />

View file

@ -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 -%>

View file

@ -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 %>
<input type="hidden" name="project" value="true" />
<%= end_form_tag %>
</div><!-- [end:action-item.id-edit-form] -->

View file

@ -86,6 +86,7 @@
<label for="item_due">Due</label><br />
<%= text_field("new_item", "due", "size" => 10, "class" => "Date", "onFocus" => "Calendar.setup", "tabindex" => 4) %>
<br /><br />
<input type="hidden" name="project" value="true" />
<input type="submit" value="Add item" tabindex="5">
<%= end_form_tag %><!--[eoform:project]-->
<%= calendar_setup( "new_item_due" ) %>

View file

@ -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 %>