myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [1945] branches/event_logging/app: Subscriptions.


From: noreply
Subject: [myexperiment-hackers] [1945] branches/event_logging/app: Subscriptions.
Date: Wed, 12 Nov 2008 09:48:40 -0500 (EST)

Revision
1945
Author
alekses6
Date
2008-11-12 09:48:40 -0500 (Wed, 12 Nov 2008)

Log Message

Subscriptions. Latest files RSS feed added.

Modified Paths

Added Paths

Diff

Modified: branches/event_logging/app/controllers/blobs_controller.rb (1944 => 1945)


--- branches/event_logging/app/controllers/blobs_controller.rb	2008-11-11 17:34:55 UTC (rev 1944)
+++ branches/event_logging/app/controllers/blobs_controller.rb	2008-11-12 14:48:40 UTC (rev 1945)
@@ -7,6 +7,7 @@
   before_filter :login_required, :except => [:index, :show, :download, :named_download, :search, :all]
   
   before_filter :find_blobs, : [:all]
+  before_filter :find_blobs_rss, : [:index]
   before_filter :find_blob_auth, :except => [:search, :index, :new, :create, :all]
   
   before_filter :initiliase_empty_objects_for_new_pages, : [:new, :create]
@@ -59,6 +60,9 @@
   def index
     respond_to do |format|
       format.html # index.rhtml
+      format.rss do
+        render :action ="" 'index.rxml', :layout => false
+      end
     end
   end
   
@@ -294,6 +298,19 @@
     @blobs = found
   end
   
+  def find_blobs_rss
+    # Only carry out if request is for RSS
+    if params[:format] and params[:format].downcase == 'rss'
+      found = Blob.find(:all, :order => "blobs.updated_at DESC", :limit => 30, :include => [ { :contribution => :policy } ])
+      
+      @rss_blobs = []
+      
+      found.each do |blob|
+        @rss_blobs << blob if blob.authorized?("show", (logged_in? ? current_user : nil))
+      end
+    end
+  end
+  
   def find_blob_auth
     begin
       blob = Blob.find(params[:id])

Added: branches/event_logging/app/views/blobs/index.rxml (0 => 1945)


--- branches/event_logging/app/views/blobs/index.rxml	                        (rev 0)
+++ branches/event_logging/app/views/blobs/index.rxml	2008-11-12 14:48:40 UTC (rev 1945)
@@ -0,0 +1,11 @@
+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
+    xml.title "myExperiment.org - Latest Files"
+    xml.link files_url
+    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 latest Files which have been uploaded to myExperiment.org"
+    render(:partial => "layouts/blob", :collection => @rss_blobs, :locals => { :xm => xml })
+  end
+end
\ No newline at end of file

Modified: branches/event_logging/app/views/contributions/_most_tabs.rhtml (1944 => 1945)


--- branches/event_logging/app/views/contributions/_most_tabs.rhtml	2008-11-11 17:34:55 UTC (rev 1944)
+++ branches/event_logging/app/views/contributions/_most_tabs.rhtml	2008-11-12 14:48:40 UTC (rev 1945)
@@ -3,8 +3,9 @@
 <% unless (most_r = Contribution.most_recent(10, type)).empty? %>
   <div class="tabContainer">
   	<div class="tabTitle">
-  		<% if controller.controller_name.downcase == 'workflows' -%>
-				<%= feed_icon_tag "Latest Workflows", formatted_workflows_path(:rss), "margin-right: 0.2em;" %>
+  		<% if ['workflows', 'blobs'].include? controller.controller_name.downcase -%>
+				<% latest_what = controller_visible_name(controller.controller_name.camelcase) %>
+				<%= feed_icon_tag "Latest #{latest_what}", eval("formatted_#{latest_what.downcase}_path(:rss)"), "margin-right: 0.2em;" %>
 			<% end -%>
   		Latest
 		</div>

Added: branches/event_logging/app/views/layouts/_blob.rxml (0 => 1945)


--- branches/event_logging/app/views/layouts/_blob.rxml	                        (rev 0)
+++ branches/event_logging/app/views/layouts/_blob.rxml	2008-11-12 14:48:40 UTC (rev 1945)
@@ -0,0 +1,10 @@
+xm.item do
+  xm.title "#{h(blob.title)} (#{h(blob.contribution.contributor.name || blob.contribution.contributor.title)}) [#{blob.content_type}]"
+  xm.description white_list(blob.body_html)
+  # next line should be enabled when files become versioned
+  # xm.version blob.current_version
+  xm.pubDate blob.contribution.updated_at.rfc822
+  xm.guid [request.host_with_port, "blob", blob.id.to_s].join(":"), "isPermaLink" => "false"
+  xm.author h(blob.contribution.contributor.name || blob.contribution.contributor.title)
+  xm.link file_url(blob)
+end
\ No newline at end of file

reply via email to

[Prev in Thread] Current Thread [Next in Thread]