Diff
Modified: branches/event_logging/app/controllers/home_controller.rb (1950 => 1951)
--- branches/event_logging/app/controllers/home_controller.rb 2008-11-12 19:40:11 UTC (rev 1950)
+++ branches/event_logging/app/controllers/home_controller.rb 2008-11-12 20:34:13 UTC (rev 1951)
@@ -5,6 +5,8 @@
class HomeController < ApplicationController
+ before_filter :find_latest_public_updated_items, : [:updated_items_rss]
+
# GET /home
def index
respond_to do |format|
@@ -20,6 +22,26 @@
end
end
+ def updated_items_rss
+ respond_to do |format|
+ format.rss do
+ render :action ="" 'updated_items.rxml', :layout => false
+ end
+ end
+ end
+
+
protected
+
+ def find_latest_public_updated_items
+ @updated_items_rss = []
+ items = Contribution.last_updated(LATEST_UPDATED_ITEMS_RSS_ENTRY_COUNT)
+ items.each do |item|
+ # should be authorized for anonymous users to view
+ # (feed partials require contributables, not contributions to display details)
+ c_utable = item.contributable
+ @updated_items_rss << c_utable if c_utable.authorized?("show", nil)
+ end
+ end
end
Modified: branches/event_logging/app/views/home/_updated_items.rhtml (1950 => 1951)
--- branches/event_logging/app/views/home/_updated_items.rhtml 2008-11-12 19:40:11 UTC (rev 1950)
+++ branches/event_logging/app/views/home/_updated_items.rhtml 2008-11-12 20:34:13 UTC (rev 1951)
@@ -3,7 +3,7 @@
<div class="box">
<b class="xtop"><b class="xb1"></b><b class="xb2"></b><b class="xb3"></b><b class="xb4"></b></b>
<div class="box_title">
- Updated Items
+ <%= feed_icon_tag("Latest updated items on myExperiment", home_updated_items_url) -%> Updated Items
</div>
<div class="content">
<% unless (contributions = Contribution.last_updated(25)).empty? %>
Added: branches/event_logging/app/views/home/updated_items.rxml (0 => 1951)
--- branches/event_logging/app/views/home/updated_items.rxml (rev 0)
+++ branches/event_logging/app/views/home/updated_items.rxml 2008-11-12 20:34:13 UTC (rev 1951)
@@ -0,0 +1,15 @@
+xml.rss "version" => "2.0", 'xmlns:opensearch' => "http://a9.com/-/spec/opensearch/1.1/", 'xmlns:atom' => "http://www.w3.org/2005/Atom" do
+ xml.channel do
+ # this RSS feed will show ALL shared items for this group that are visible to anonymous users
+ xml.title "myExperiment.org - Latest Updated Items"
+ xml.link url_for(:controller => 'home', :action ="" 'index')
+ xml.language "en-us"
+ xml.ttl "60"
+ xml.tag! "atom:link", :rel => 'search', :type => 'application/opensearchdescription+xml', :href ="" "http://#{request.host_with_port}/open_search.xml"
+ xml.description "RSS feed listing the most recently updated items on myExperiment.org"
+ # iterate through the collection manually, as it contains items of different types
+ @updated_items_rss.each do |item|
+ render(:partial => "layouts/#{item.class.to_s.downcase}", :object => item, :locals => { :xm => xml })
+ end
+ end
+end
\ No newline at end of file
Modified: branches/event_logging/config/environment_private.rb.pre (1950 => 1951)
--- branches/event_logging/config/environment_private.rb.pre 2008-11-12 19:40:11 UTC (rev 1950)
+++ branches/event_logging/config/environment_private.rb.pre 2008-11-12 20:34:13 UTC (rev 1951)
@@ -111,4 +111,7 @@
# =========== Settings for RSS feeds ===========
# number of entries to show in "latest workflows|files|packs" feeds
-LATEST_CONTRIBUTABLES_RSS_ENTRY_COUNT = 30
\ No newline at end of file
+LATEST_CONTRIBUTABLES_RSS_ENTRY_COUNT = 30
+
+# "latest updated items" on "home" page
+LATEST_UPDATED_ITEMS_RSS_ENTRY_COUNT = 25
\ No newline at end of file
Modified: branches/event_logging/config/routes.rb (1950 => 1951)
--- branches/event_logging/config/routes.rb 2008-11-12 19:40:11 UTC (rev 1950)
+++ branches/event_logging/config/routes.rb 2008-11-12 20:34:13 UTC (rev 1951)
@@ -236,6 +236,7 @@
map.resources :announcements
map.home_public_news 'home/public_news.rss', :controller => 'home', :action ="" 'public_news_rss', :format => 'rss'
+ map.home_updated_items 'home/updated_items.rss', :controller => 'home', :action ="" 'updated_items_rss', :format => 'rss'
# Install the default route as the lowest priority.
map.connect ':controller/:action/:id'