From eb0e218603fb334f3281515f15b23b246c6b351d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 27 May 2008 16:49:18 +0000 Subject: [PATCH] Adds new projects atom feed (#1290). git-svn-id: http://redmine.rubyforge.org/svn/trunk@1465 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/projects_controller.rb | 12 ++++++++++-- app/views/projects/index.rhtml | 9 +++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 320def41b..d15c6bc2a 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -49,8 +49,16 @@ class ProjectsController < ApplicationController projects = Project.find :all, :conditions => Project.visible_by(User.current), :include => :parent - @project_tree = projects.group_by {|p| p.parent || p} - @project_tree.each_key {|p| @project_tree[p] -= [p]} + respond_to do |format| + format.html { + @project_tree = projects.group_by {|p| p.parent || p} + @project_tree.each_key {|p| @project_tree[p] -= [p]} + } + format.atom { + render_feed(projects.sort_by(&:created_on).reverse.slice(0, Setting.feeds_limit.to_i), + :title => "#{Setting.app_title}: #{l(:label_project_latest)}") + } + end end # Add a new project diff --git a/app/views/projects/index.rhtml b/app/views/projects/index.rhtml index b8bb62ebb..e12b05979 100644 --- a/app/views/projects/index.rhtml +++ b/app/views/projects/index.rhtml @@ -17,9 +17,14 @@ <% end %> <% if User.current.logged? %> -
+

<%= l(:label_my_projects) %> -

+

<% end %> +

+<%= l(:label_export_to) %> +<%= link_to 'Atom', {:format => 'atom', :key => User.current.rss_key}, :class => 'feed' %> +

+ <% html_title(l(:label_project_plural)) -%> -- 2.39.5