adds txt feed for projects and their actions. Fixes #694

git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@820 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
lrbalt 2008-04-18 19:30:25 +00:00
parent 2a19af1476
commit c3009f89c2
3 changed files with 32 additions and 9 deletions

View file

@ -10,17 +10,30 @@ class ProjectsController < ApplicationController
def index
@projects = current_user.projects(true)
@contexts = current_user.contexts(true)
init_not_done_counts(['project'])
if params[:only_active_with_no_next_actions]
@projects = @projects.select { |p| p.active? && count_undone_todos(p) == 0 }
if params[:projects_and_actions]
projects_and_actions
else
@contexts = current_user.contexts(true)
init_not_done_counts(['project'])
if params[:only_active_with_no_next_actions]
@projects = @projects.select { |p| p.active? && count_undone_todos(p) == 0 }
end
respond_to do |format|
format.html &render_projects_html
format.xml { render :xml => @projects.to_xml( :except => :user_id ) }
format.rss &render_rss_feed
format.atom &render_atom_feed
format.text &render_text_feed
end
end
end
def projects_and_actions
@projects = @projects.select { |p| p.active? }
respond_to do |format|
format.html &render_projects_html
format.xml { render :xml => @projects.to_xml( :except => :user_id ) }
format.rss &render_rss_feed
format.atom &render_atom_feed
format.text &render_text_feed
format.text {
render :action => 'index_text_projects_and_actions', :layout => false, :content_type => Mime::TEXT
}
end
end

View file

@ -54,6 +54,10 @@
<%= text_formatted_link({:controller => 'projects', :action => 'index', :only_active_with_no_next_actions => true}) %>
Active projects with no next actions
</li>
<li>
<%= text_formatted_link({:controller => 'projects', :action => 'index', :projects_and_actions => true}) %>
Active projects with their actions
</li>
<li><h4>Feeds for incomplete actions in a specific context:</h4>
<ul>
<% for context in @contexts %>

View file

@ -0,0 +1,6 @@
<% @projects.each do |p| -%>
<%= p.name.upcase -%>
<% actions = p.todos.select { |t| t.active? } -%>
<%= render :partial => "todos/text_todo", :collection => actions -%>
<% end -%>