From 10cf1ccc1abe1c6ffdf21259b54292f9068b569c Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sat, 17 Mar 2007 15:18:50 +0000 Subject: added rss/atom feeds at project levels for: * news * new issues reported * details of issue changes issue cutom queries can be used as feeds git-svn-id: http://redmine.rubyforge.org/svn/trunk@339 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/views/feeds/history.rxml | 28 ++++++++++++++++++++++++++++ app/views/feeds/history_atom.rxml | 28 ++++++++++++++++++++++++++++ app/views/feeds/issues.rxml | 20 ++++++++++++++++++++ app/views/feeds/issues_atom.rxml | 22 ++++++++++++++++++++++ app/views/feeds/news.rxml | 38 +++++++++++++++++++------------------- app/views/feeds/news_atom.rxml | 22 ++++++++++++++++++++++ app/views/projects/feeds.rhtml | 33 +++++++++++++++++++++++++++++++++ app/views/projects/show.rhtml | 4 ++++ 8 files changed, 176 insertions(+), 19 deletions(-) create mode 100644 app/views/feeds/history.rxml create mode 100644 app/views/feeds/history_atom.rxml create mode 100644 app/views/feeds/issues.rxml create mode 100644 app/views/feeds/issues_atom.rxml create mode 100644 app/views/feeds/news_atom.rxml create mode 100644 app/views/projects/feeds.rhtml (limited to 'app/views') diff --git a/app/views/feeds/history.rxml b/app/views/feeds/history.rxml new file mode 100644 index 000000000..b7e5a3509 --- /dev/null +++ b/app/views/feeds/history.rxml @@ -0,0 +1,28 @@ +xml.instruct! +xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do + xml.channel do + xml.title @title + xml.link url_for(:controller => 'welcome', :only_path => false) + xml.pubDate CGI.rfc1123_date(@journals.first ? @journals.first.created_on : Time.now) + xml.description l(:label_reported_issues) + @journals.each do |journal| + issue = journal.issue + xml.item do + xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}" + url = url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) + xml.link url + xml.description do + xml.text! h(journal.notes) + xml.text! "" + end + xml.pubDate CGI.rfc1123_date(journal.created_on) + xml.guid url + xml.author h(journal.user.name) + end + end + end +end \ No newline at end of file diff --git a/app/views/feeds/history_atom.rxml b/app/views/feeds/history_atom.rxml new file mode 100644 index 000000000..9d82ef606 --- /dev/null +++ b/app/views/feeds/history_atom.rxml @@ -0,0 +1,28 @@ +xml.instruct! +xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do + xml.title @title + xml.link "rel" => "self", "href" => url_for(:controller => 'feeds', :action => 'history', :format => 'atom', :only_path => false) + xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) + xml.id url_for(:controller => 'welcome', :only_path => false) + xml.updated CGI.rfc1123_date(@journals.first.created_on) if @journals.any? + xml.author { xml.name "#{Setting.app_title}" } + @journals.each do |journal| + issue = journal.issue + xml.entry do + xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}" + xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) + xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) + xml.updated CGI.rfc1123_date(journal.created_on) + xml.author { xml.name journal.user.name } + xml.summary journal.notes + xml.content "type" => "html" do + xml.text! journal.notes + xml.text! "" + end + end + end +end \ No newline at end of file diff --git a/app/views/feeds/issues.rxml b/app/views/feeds/issues.rxml new file mode 100644 index 000000000..fb120b7cb --- /dev/null +++ b/app/views/feeds/issues.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 @title + xml.link url_for(:controller => 'welcome', :only_path => false) + xml.pubDate CGI.rfc1123_date(@issues.first ? @issues.first.created_on : Time.now) + xml.description l(:label_reported_issues) + @issues.each do |issue| + xml.item do + xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}" + url = url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) + xml.link url + xml.description h(issue.description) + xml.pubDate CGI.rfc1123_date(issue.created_on) + xml.guid url + xml.author h(issue.author.name) + end + end + end +end \ No newline at end of file diff --git a/app/views/feeds/issues_atom.rxml b/app/views/feeds/issues_atom.rxml new file mode 100644 index 000000000..bb15fc493 --- /dev/null +++ b/app/views/feeds/issues_atom.rxml @@ -0,0 +1,22 @@ +xml.instruct! +xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do + xml.title @title + xml.link "rel" => "self", "href" => url_for(:controller => 'feeds', :action => 'issues', :format => 'atom', :only_path => false) + xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) + xml.id url_for(:controller => 'welcome', :only_path => false) + xml.updated CGI.rfc1123_date(@issues.first.updated_on) if @issues.any? + xml.author { xml.name "#{Setting.app_title}" } + @issues.each do |issue| + xml.entry do + xml.title "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}" + xml.link "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) + xml.id url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false) + xml.updated CGI.rfc1123_date(issue.updated_on) + xml.author { xml.name issue.author.name } + xml.summary issue.description + xml.content "type" => "html" do + xml.text! issue.description + end + end + end +end \ No newline at end of file diff --git a/app/views/feeds/news.rxml b/app/views/feeds/news.rxml index a85d86715..d7248b6cb 100644 --- a/app/views/feeds/news.rxml +++ b/app/views/feeds/news.rxml @@ -1,20 +1,20 @@ -xml.instruct! -xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do - xml.channel do - xml.title "#{Setting.app_title}: #{l(:label_news_latest)}" - xml.link url_for(:controller => 'welcome', :only_path => false) - xml.pubDate CGI.rfc1123_date(@news.first ? @news.first.created_on : Time.now) - xml.description 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 +xml.instruct! +xml.rss "version" => "2.0", "xmlns:dc" => "http://purl.org/dc/elements/1.1/" do + xml.channel do + xml.title "#{Setting.app_title}: #{l(:label_news_latest)}" + xml.link url_for(:controller => 'welcome', :only_path => false) + xml.pubDate CGI.rfc1123_date(@news.first ? @news.first.created_on : Time.now) + xml.description 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/feeds/news_atom.rxml b/app/views/feeds/news_atom.rxml new file mode 100644 index 000000000..2550341c8 --- /dev/null +++ b/app/views/feeds/news_atom.rxml @@ -0,0 +1,22 @@ +xml.instruct! +xml.feed "xmlns" => "http://www.w3.org/2005/Atom" do + xml.title "#{Setting.app_title}: #{l(:label_news_latest)}" + xml.link "rel" => "self", "href" => url_for(:controller => 'feeds', :action => 'news', :format => 'atom', :only_path => false) + xml.link "rel" => "alternate", "href" => url_for(:controller => 'welcome', :only_path => false) + xml.id url_for(:controller => 'welcome', :only_path => false) + xml.updated CGI.rfc1123_date(@news.first.created_on) if @news.any? + xml.author { xml.name "#{Setting.app_title}" } + @news.each do |news| + xml.entry do + xml.title news.title + xml.link "rel" => "alternate", "href" => url_for(:controller => 'news' , :action => 'show', :id => news, :only_path => false) + xml.id url_for(:controller => 'news' , :action => 'show', :id => news, :only_path => false) + xml.updated CGI.rfc1123_date(news.created_on) + xml.author { xml.name news.author.name } + xml.summary h(news.summary) + xml.content "type" => "html" do + xml.text! news.description + end + end + end +end \ No newline at end of file diff --git a/app/views/projects/feeds.rhtml b/app/views/projects/feeds.rhtml new file mode 100644 index 000000000..037469a8a --- /dev/null +++ b/app/views/projects/feeds.rhtml @@ -0,0 +1,33 @@ +

<%= l(:label_feed_plural) %> (<%=h @project.name %>)

+ + + + + + + + + + + + + +<% @queries.each do |query| %> + + + + + + + + + +<% end %> + + + + + + + +

<%= l(:label_issue_plural) %>

<%= l(:label_reported_issues) %><%= link_to 'RSS', {:controller => 'feeds', :action => 'issues', :project_id => @project, :key => @key}, :class => 'icon icon-feed' %><%= link_to 'Atom', {:controller => 'feeds', :action => 'issues', :project_id => @project, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %>
<%= l(:label_changes_details) %><%= link_to 'RSS', {:controller => 'feeds', :action => 'history', :project_id => @project, :key => @key}, :class => 'icon icon-feed' %><%= link_to 'Atom', {:controller => 'feeds', :action => 'history', :project_id => @project, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %>

<%=h query.name %>

<%= l(:label_reported_issues) %><%= link_to 'RSS', {:controller => 'feeds', :action => 'issues', :project_id => @project, :query_id => query, :key => @key}, :class => 'icon icon-feed' %><%= link_to 'Atom', {:controller => 'feeds', :action => 'issues', :project_id => @project, :query_id => query, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %>
<%= l(:label_changes_details) %><%= link_to 'RSS', {:controller => 'feeds', :action => 'history', :project_id => @project, :query_id => query, :key => @key}, :class => 'icon icon-feed' %><%= link_to 'Atom', {:controller => 'feeds', :action => 'history', :project_id => @project, :query_id => query, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %>
 

<%= l(:label_news_plural) %>

<%= l(:label_news_latest) %><%= link_to 'RSS', {:controller => 'feeds', :action => 'news', :project_id => @project, :key => @key}, :class => 'icon icon-feed' %><%= link_to 'Atom', {:controller => 'feeds', :action => 'news', :project_id => @project, :key => @key, :format => 'atom'}, :class => 'icon icon-feed' %>
\ No newline at end of file diff --git a/app/views/projects/show.rhtml b/app/views/projects/show.rhtml index b38eceaac..9ecbbb663 100644 --- a/app/views/projects/show.rhtml +++ b/app/views/projects/show.rhtml @@ -1,3 +1,7 @@ +
+<%= link_to l(:label_feed_plural), {:action => 'feeds', :id => @project}, :class => 'icon icon-feed' %> +
+

<%=l(:label_overview)%>

-- cgit v1.2.3