myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [1965] branches/event_logging: Subscriptions.


From: noreply
Subject: [myexperiment-hackers] [1965] branches/event_logging: Subscriptions.
Date: Thu, 13 Nov 2008 10:06:26 -0500 (EST)

Revision
1965
Author
alekses6
Date
2008-11-13 10:06:25 -0500 (Thu, 13 Nov 2008)

Log Message

Subscriptions. Added "News" tab and RSS feed for individual packs.

Modified Paths

Added Paths

Diff

Modified: branches/event_logging/app/controllers/packs_controller.rb (1964 => 1965)


--- branches/event_logging/app/controllers/packs_controller.rb	2008-11-13 14:50:31 UTC (rev 1964)
+++ branches/event_logging/app/controllers/packs_controller.rb	2008-11-13 15:06:25 UTC (rev 1965)
@@ -6,7 +6,7 @@
 class PacksController < ApplicationController
   include ApplicationHelper
   
-  before_filter :login_required, :except => [:index, :show, :all, :search, :items, :download]
+  before_filter :login_required, :except => [:index, :show, :all, :search, :items, :download, :news]
   
   before_filter :find_packs, : [:all]
   before_filter :find_packs_rss, : [:index]
@@ -59,6 +59,16 @@
     end
   end
   
+  # GET /packs/1/news.rss
+  def news
+    respond_to do |format|
+      format.html { redirect_to pack_path(params[:id]) }
+      format.rss do 
+        render :action ="" 'news.rxml', :layout => false
+      end
+    end
+  end
+  
   # GET /packs/1;download
   def download
     # this is done every time the donwload is requested;

Added: branches/event_logging/app/views/packs/news.rxml (0 => 1965)


--- branches/event_logging/app/views/packs/news.rxml	                        (rev 0)
+++ branches/event_logging/app/views/packs/news.rxml	2008-11-13 15:06:25 UTC (rev 1965)
@@ -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 - News and Status Updates for \"#{contributable_name_from_instance(@pack)}\" Pack"
+    xml.link pack_url(@pack)
+    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 status updates for #{contributable_name_from_instance(@pack)} Pack on myExperiment.org"
+    render(:partial => "layouts/news_entry", :collection => news_from_log_for_contributable(@pack, Time.now, Time.now-DEFAULT_CONTRIBUTABLE_NEWS_TIMEFRAME, DEFAULT_RSS_ENTRY_COUNT, nil), :locals => { :xm => xml })
+  end
+end
\ No newline at end of file

Modified: branches/event_logging/app/views/packs/show.rhtml (1964 => 1965)


--- branches/event_logging/app/views/packs/show.rhtml	2008-11-13 14:50:31 UTC (rev 1964)
+++ branches/event_logging/app/views/packs/show.rhtml	2008-11-13 15:06:25 UTC (rev 1965)
@@ -21,17 +21,19 @@
 	  <%= link_to "Add an Item", "#add_item" %>
 		|
 	<% end %>
-	<% if logged_in? and @pack.owner? current_user %>
-	  <!-- NB! Index of the 'sharing' tab might change! -->
-	  <a href="" 
-		|
-	<% end %>
 	<%= link_to "Tags <span id='mini_nav_tag_link'>(address@hidden)</span>", "#tags" %>
 	|
 	<%= link_to "Featured in Packs (address@hidden)", "#featured_in_packs" %>
 	|
 	<%= link_to "Favourited By (address@hidden)", "#favourited_by" %>
-	| 
+	|
+	<a href="" 
+	|
+	<% if logged_in? and @pack.owner? current_user %>
+    <!-- NB! Index of the 'sharing' tab might change! -->
+    <a href="" 
+	|
+	<% end %>
 	<%= link_to "Comments (address@hidden)", "#comments" %>
 	|
 </div>
@@ -149,6 +151,19 @@
 
 <div id="tabsContainer" class="tabsContainer"></div>
 	
+	<a name="news"></a>
+	<div class="tabContainer">
+	  <div class="tabTitle"><%= feed_icon_tag("\"#{contributable_name_from_instance(@pack)}\" Pack news", formatted_news_pack_path(@pack, :rss)) -%> News</div>
+	  <div class="tabContent">  
+	    <% benchmark "Pack page news feed" do %>
+	      <% viewer_id = (logged_in? ? current_user.id : "public") -%>
+				<% cache_timeout({ :controller => 'news', :action ="" 'pack', :id => @pack.id, :viewer => viewer_id } , NEWS_CACHE_TIMEOUT.seconds.from_now ) do -%>
+				  <%= render :partial => "layouts/news", :locals => { :collection => news(@pack, true, Time.now, Time.now-DEFAULT_CONTRIBUTABLE_NEWS_TIMEFRAME, DEFAULT_CONTRIBUTABLE_NEWS_COUNT, current_user) } %>
+	      <% end -%>
+			<% end %>
+	  </div>
+	</div>
+	
 <% if logged_in? and @pack.owner? current_user %>
   
 	<a name="sharing"></a>

Modified: branches/event_logging/config/environment_private.rb.pre (1964 => 1965)


--- branches/event_logging/config/environment_private.rb.pre	2008-11-13 14:50:31 UTC (rev 1964)
+++ branches/event_logging/config/environment_private.rb.pre	2008-11-13 15:06:25 UTC (rev 1965)
@@ -120,6 +120,6 @@
 LATEST_GROUPS_RSS_ENTRY_COUNT = 10
 
 # various feeds on "home" page
-# (DEFAULT_RSS_ENTRY_COUNT is currently used for "latest tags|comments|reviews"; RSS news feed for Files, Workflows)
+# (DEFAULT_RSS_ENTRY_COUNT is currently used for "latest tags|comments|reviews"; RSS news feed for Files, Workflows, Packs)
 DEFAULT_RSS_ENTRY_COUNT = 20
 LATEST_UPDATED_ITEMS_RSS_ENTRY_COUNT = 25
\ No newline at end of file

Modified: branches/event_logging/config/routes.rb (1964 => 1965)


--- branches/event_logging/config/routes.rb	2008-11-13 14:50:31 UTC (rev 1964)
+++ branches/event_logging/config/routes.rb	2008-11-13 15:06:25 UTC (rev 1965)
@@ -51,6 +51,7 @@
                  :favourite => :post,
                  :favourite_delete => :delete,
                  :tag => :post,
+                 :news => :get,
                  :new_item => :get,
                  :create_item => :post, 
                  :edit_item => :get,

reply via email to

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