diff --git a/app/controllers/feeds_controller.rb b/app/controllers/feeds_controller.rb new file mode 100644 index 00000000..bfce26f8 --- /dev/null +++ b/app/controllers/feeds_controller.rb @@ -0,0 +1,25 @@ +# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +class FeedsController < ApplicationController + session :off + + def news + @news = News.find :all, :order => 'news.created_on DESC', :limit => 10, :include => [ :author, :project ] + @headers["Content-Type"] = "application/rss+xml" + end +end diff --git a/app/helpers/feeds_helper.rb b/app/helpers/feeds_helper.rb new file mode 100644 index 00000000..850bd44f --- /dev/null +++ b/app/helpers/feeds_helper.rb @@ -0,0 +1,19 @@ +# redMine - project management software +# Copyright (C) 2006 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +module FeedsHelper +end diff --git a/app/views/feeds/news.rxml b/app/views/feeds/news.rxml new file mode 100644 index 00000000..50d4a9ab --- /dev/null +++ b/app/views/feeds/news.rxml @@ -0,0 +1,20 @@ +xml.instruct! +xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do + xml.channel do + xml.title "#{$RDM_HEADER_TITLE}: #{l(:label_news_latest)}" + xml.link url_for(:controller => '', :only_path => false) + xml.pubDate CGI.rfc1123_date(@news.first.created_on) + xml.description "#{$RDM_HEADER_TITLE}: #{l(:label_news_latest)}" + @news.each do |news| + xml.item do + xml.title "#{news.project.name}: #{news.title}" + news_url = url_for(:controller => 'news' , :action => 'show', :id => news, :only_path => false) + xml.link news_url + xml.description h(news.summary) + xml.pubDate CGI.rfc1123_date(news.created_on) + xml.guid news_url + xml.author h(news.author.name) + end + end + end +end \ No newline at end of file diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index a435afe8..eeea3ef2 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -14,6 +14,8 @@ <%= javascript_include_tag 'calendar/calendar-setup' %> <%= stylesheet_link_tag 'calendar' %> <%= stylesheet_link_tag 'jstoolbar' %> + +<%= yield :header_tags %> diff --git a/app/views/welcome/index.rhtml b/app/views/welcome/index.rhtml index 24c969e6..422c94e7 100644 --- a/app/views/welcome/index.rhtml +++ b/app/views/welcome/index.rhtml @@ -21,3 +21,7 @@ + +<% content_for :header_tags do %> +<%= auto_discovery_link_tag(:rss, {:controller => 'feeds' , :action => 'news' }) %> +<% end %> \ No newline at end of file diff --git a/doc/CHANGELOG b/doc/CHANGELOG index 36bac591..204453b5 100644 --- a/doc/CHANGELOG +++ b/doc/CHANGELOG @@ -26,6 +26,7 @@ http://redmine.org/ * calendar date picker for date fields (LGPL DHTML Calendar http://sourceforge.net/projects/jscalendar) * new filter in issues list: Author * ajaxified paginators +* news rss feed added * option to set number of results per page on issues list * localized csv separator (comma/semicolon) * csv output encoded to ISO-8859-1