From: Jean-Philippe Lang Date: Fri, 31 Aug 2007 20:22:36 +0000 (+0000) Subject: Added atom feed on the new cross-project issue list. X-Git-Tag: 0.6.0~196 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c68dac7e9ad0e4f8d46a5799de7aef75d28da664;p=redmine.git Added atom feed on the new cross-project issue list. git-svn-id: http://redmine.rubyforge.org/svn/trunk@686 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/app/controllers/application.rb b/app/controllers/application.rb index b1e2b3d73..9a7096728 100644 --- a/app/controllers/application.rb +++ b/app/controllers/application.rb @@ -135,8 +135,9 @@ class ApplicationController < ActionController::Base return false end - def render_feed(items, options={}) - @items = items.sort {|x,y| y.event_datetime <=> x.event_datetime } + def render_feed(items, options={}) + @items = items || [] + @items.sort! {|x,y| y.event_datetime <=> x.event_datetime } @title = options[:title] || Setting.app_title render :template => "common/feed.atom.rxml", :layout => false, :content_type => 'application/atom+xml' end diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index fe1c78884..b83d950ea 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -18,6 +18,7 @@ class IssuesController < ApplicationController layout 'base', :except => :export_pdf before_filter :find_project, :authorize, :except => :index + accept_key_auth :index cache_sweeper :issue_sweeper, :only => [ :edit, :change_status, :destroy ] @@ -50,7 +51,10 @@ class IssuesController < ApplicationController :limit => @issue_pages.items_per_page, :offset => @issue_pages.current.offset end - render :layout => false if request.xhr? + respond_to do |format| + format.html { render :layout => false if request.xhr? } + format.atom { render_feed(@issues, :title => l(:label_issue_plural)) } + end end def show diff --git a/app/views/issues/index.rhtml b/app/views/issues/index.rhtml index 0f63ba96f..cd7ace561 100644 --- a/app/views/issues/index.rhtml +++ b/app/views/issues/index.rhtml @@ -53,3 +53,7 @@ [ <%= @issue_pages.current.first_item %> - <%= @issue_pages.current.last_item %> / <%= @issue_count %> ]

<% end %> <% end %> + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :page => nil, :key => User.current.rss_key})) %> +<% end %>