Fixed broken editing of next actions within project/show.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@36 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
bsag 2005-03-05 10:23:49 +00:00
parent c9d8ebda95
commit 6703f48333
4 changed files with 13 additions and 4 deletions

View file

@ -23,5 +23,14 @@ class Todo < ActiveRecord::Base
end
end
# Piggy-back technique to avoid superfluous calls to the DB
#
def self.find_all_with_project_name(filter,sort)
find_by_sql(
"SELECT todos.*, projects.name as project_name " +
"FROM todos, projects " +
"WHERE #{filter} AND todos.project_id = projects.id " +
"ORDER BY #{sort}"
)
end
end

View file

@ -1,7 +1,7 @@
<% @item = not_done %>
<tr>
<td valign="top"><%= check_box( "item", "done", "onclick" => "document.location.href='/todo/toggle_check/#{@item.id}'" ) %></td>
<td valign="top" width="30"><%= link_image_to( "edit", { :action => "edit", :id => @item.id }, :title => "Edit item", :size => "10x10" ) + " " + link_image_to( "delete", { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %></td>
<td valign="top" width="30"><%= link_image_to( "edit", { :controller => "todo", :action => "edit", :id => @item.id }, :title => "Edit item", :size => "10x10" ) + " " + link_image_to( "delete", { :controller => "todo", :action => "destroy", :id => @item.id }, :title => "Delete item", :size => "10x10", :confirm => "Are you sure you want to delete this entry: #{@item.description}" ) + " " %></td>
<td valign="top"><%= due_date( @item.due ) %>
<%= @item.description %>
<% if @item.project_id %>

View file

@ -7,7 +7,7 @@
<td valign="top"><%= due_date( @notdone_item.due ) %>
<%= @notdone_item.description %>
<% if @notdone_item.project_id %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :id => @notdone_item.project_id }, :title => "View project: #{@notdone_item.project['name']}" ) %>
<%= link_to( "[P]", { :controller => "project", :action => "show", :id => @notdone_item.project_id }, :title => "View project: #{@notdone_item.project.name}" ) %>
<% end %>
<% if @notdone_item.notes? %>
<%= "<a href=\"javascript:toggle('" + @notdone_item.id.to_s + "')\" title=\"Show notes\">" + $notes_img + "</a>" %>

View file

@ -1,6 +1,6 @@
<div id="display_box">
<% for @shown_place in @shown_places %>
<% @not_done = Todo.find_all( "done=0 AND context_id=#{@shown_place.id}", "created ASC" ) %>
<% @not_done = Todo.find_all("done=0 AND context_id=#{@shown_place.id}", "created ASC") %>
<% if !@not_done.empty? %>
<div class="contexts">
<h2><%= link_to( "#{@shown_place.name.capitalize}", :controller => "context", :action => "show", :id => @shown_place.id ) %></h2>