From c3009f89c2d11d9f4fb4bd4ba9f5e73ef0e6b989 Mon Sep 17 00:00:00 2001 From: lrbalt Date: Fri, 18 Apr 2008 19:30:25 +0000 Subject: [PATCH] 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 --- tracks/app/controllers/projects_controller.rb | 31 +++++++++++++------ tracks/app/views/feedlist/index.rhtml | 4 +++ .../index_text_projects_and_actions.rhtml | 6 ++++ 3 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 tracks/app/views/projects/index_text_projects_and_actions.rhtml diff --git a/tracks/app/controllers/projects_controller.rb b/tracks/app/controllers/projects_controller.rb index fb5d53db..b4faf97f 100644 --- a/tracks/app/controllers/projects_controller.rb +++ b/tracks/app/controllers/projects_controller.rb @@ -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 diff --git a/tracks/app/views/feedlist/index.rhtml b/tracks/app/views/feedlist/index.rhtml index 0b37ea82..26df25dd 100644 --- a/tracks/app/views/feedlist/index.rhtml +++ b/tracks/app/views/feedlist/index.rhtml @@ -54,6 +54,10 @@ <%= text_formatted_link({:controller => 'projects', :action => 'index', :only_active_with_no_next_actions => true}) %> Active projects with no next actions +
  • + <%= text_formatted_link({:controller => 'projects', :action => 'index', :projects_and_actions => true}) %> + Active projects with their actions +
  • Feeds for incomplete actions in a specific context: