* news rss feed added

* "header_tags" block added to allow inclusion of page specific tags in the html header (stylesheets, javascripts, feeds...)

git-svn-id: http://redmine.rubyforge.org/svn/trunk@121 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2006-12-26 16:19:12 +00:00
parent 1f3380bfad
commit 58f8a23d58
6 changed files with 71 additions and 0 deletions

View File

@ -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

View File

@ -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

20
app/views/feeds/news.rxml Normal file
View File

@ -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

View File

@ -14,6 +14,8 @@
<%= javascript_include_tag 'calendar/calendar-setup' %>
<%= stylesheet_link_tag 'calendar' %>
<%= stylesheet_link_tag 'jstoolbar' %>
<!-- page specific tags -->
<%= yield :header_tags %>
</head>
<body>

View File

@ -21,3 +21,7 @@
</ul>
</div>
</div>
<% content_for :header_tags do %>
<%= auto_discovery_link_tag(:rss, {:controller => 'feeds' , :action => 'news' }) %>
<% end %>

View File

@ -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