Projects marked as complete will no longer show up in the add new action form. I also cleaned up a little bit of ruby Array code in the sidebar. The reject{} method can be used a lot where we have been using collect{ ... }.compact. Fixes #297.

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@248 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lukemelia 2006-05-26 19:46:10 +00:00
parent d7acb70ee3
commit d0784999c1
2 changed files with 5 additions and 5 deletions

View file

@ -49,7 +49,7 @@
<% unless controller.controller_name == "project" -%>
<label for="todo_project_id">Project</label><br />
<%= collection_select( "todo", "project_id", @projects, "id", "name",
<%= collection_select( "todo", "project_id", @projects.reject{|p| p.done}, "id", "name",
{ :include_blank => true }, {"tabindex" => 4}) %><br />
<% end -%>

View file

@ -1,6 +1,6 @@
<h3>Active Projects:</h3>
<ul>
<% for project in @projects.collect { |x| x.done? ? nil:x }.compact -%>
<% for project in @projects.reject{|p| p.done } -%>
<li><%= link_to( sanitize(project.name), { :controller => "project", :action => "show",
:name => urlize(project.name) } ) + " (" + project.count_undone_todos("actions") + ")" %></li>
<% end -%>
@ -8,7 +8,7 @@
<h3>Completed Projects:</h3>
<ul>
<% for project in @projects.collect { |x| x.done? ? x:nil }.compact -%>
<% for project in @projects.reject{|p| !p.done } -%>
<li><%= link_to( sanitize(project.name), { :controller => "project", :action => "show",
:name => urlize(project.name) } ) + " (" + project.count_undone_todos("actions") + ")" %></li>
<% end -%>
@ -16,7 +16,7 @@
<h3>Active Contexts:</h3>
<ul>
<% for context in @contexts.collect { |x| x.hide? ? nil:x }.compact -%>
<% for context in @contexts.reject{|c| c.hide } -%>
<li><%= link_to( sanitize(context.name), { :controller => "context", :action => "show",
:name => urlize(context.name) } ) + " (" + context.count_undone_todos("actions") + ")" %></li>
<% end -%>
@ -24,7 +24,7 @@
<h3>Hidden Contexts:</h3>
<ul>
<% for context in @contexts.collect { |x| x.hide? ? x:nil }.compact -%>
<% for context in @contexts.reject{|c| !c.hide } -%>
<li><%= link_to( sanitize(context.name), { :controller => "context", :action => "show",
:name => urlize(context.name) } ) + " (" + context.count_undone_todos("actions") + ")" %></li>
<% end -%>