myexperiment-hackers
[Top][All Lists]
Advanced

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

[myexperiment-hackers] [3800] branches/packs: created home page activity


From: noreply
Subject: [myexperiment-hackers] [3800] branches/packs: created home page activity feed
Date: Tue, 19 Nov 2013 16:46:07 +0000 (UTC)

Revision
3800
Author
dgc
Date
2013-11-19 16:46:06 +0000 (Tue, 19 Nov 2013)

Log Message

created home page activity feed

Modified Paths

Diff

Modified: branches/packs/app/controllers/comments_controller.rb (3799 => 3800)


--- branches/packs/app/controllers/comments_controller.rb	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/controllers/comments_controller.rb	2013-11-19 16:46:06 UTC (rev 3800)
@@ -53,7 +53,7 @@
     respond_to do |format|
       if params[:activity_feed] || @context.kind_of?(Activity)
         @context = @context.context if @context.kind_of?(Activity)
-        activities = activities_for_feed(:context => @context, :user => current_user)
+        activities = activities_for_feed(:contexts => address@hidden, :user => current_user)
         format.html { render :partial => "activities/list", :locals => { :context => @context, :activities => activities, :user => current_user } }
       elsif ajaxy
         format.html { render :partial => "comments/comments", :locals => { :commentable => @context } }

Modified: branches/packs/app/controllers/home_controller.rb (3799 => 3800)


--- branches/packs/app/controllers/home_controller.rb	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/controllers/home_controller.rb	2013-11-19 16:46:06 UTC (rev 3800)
@@ -19,8 +19,13 @@
       format.atom {
         @title = "Personal feed"
         @id = @resource = home_url
-        @entries = activities_for_feed(:user => current_user, :no_combine => true)
 
+        resources = current_user.personal_resources_and_subscriptions if logged_in?
+
+        @entries = activities_for_feed(:contexts => resources,
+            :user => current_user,
+            :no_combine => true)
+
         unless @entries.empty? || @entries.last.empty?
           @updated = @entries.last.last.timestamp.to_datetime.rfc3339
         end

Modified: branches/packs/app/controllers/networks_controller.rb (3799 => 3800)


--- branches/packs/app/controllers/networks_controller.rb	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/controllers/networks_controller.rb	2013-11-19 16:46:06 UTC (rev 3800)
@@ -284,7 +284,7 @@
         @title = @network.title
         @id = @resource = network_url(@network)
         @updated = @network.updated_at.to_datetime.rfc3339
-        @entries = activities_for_feed(:context => @network, :user => current_user, :no_combine => true)
+        @entries = activities_for_feed(:contexts => address@hidden, :user => current_user, :no_combine => true)
 
         render "activities/feed.atom"
       }
@@ -394,7 +394,7 @@
           page.replace_html "mini_nav_tag_link", "(#{unique_tag_count})"
           page.replace_html "tags_box_header_tag_count_span", "(#{unique_tag_count})"
           page.replace_html "tags_inner_box", :partial => "tags/tags_box_inner", :locals => { :taggable => @network, :owner_id => @network.user_id } 
-          page.replace_html "activities", :partial => "activities/list", :locals => { :context => @network, :activities => activities_for_feed(:context => @network, :user => current_user), :user => current_user }
+          page.replace_html "activities", :partial => "activities/list", :locals => { :context => @network, :activities => activities_for_feed(:contexts => address@hidden, :user => current_user), :user => current_user }
         end
       }
     end

Modified: branches/packs/app/controllers/packs_controller.rb (3799 => 3800)


--- branches/packs/app/controllers/packs_controller.rb	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/controllers/packs_controller.rb	2013-11-19 16:46:06 UTC (rev 3800)
@@ -121,7 +121,7 @@
         @title = @pack.title
         @id = @resource = pack_url(@pack)
         @updated = @pack.updated_at.to_datetime.rfc3339
-        @entries = activities_for_feed(:context => @pack, :user => current_user, :no_combine => true)
+        @entries = activities_for_feed(:contexts => address@hidden, :user => current_user, :no_combine => true)
 
         render "activities/feed.atom"
       }

Modified: branches/packs/app/helpers/activities_helper.rb (3799 => 3800)


--- branches/packs/app/helpers/activities_helper.rb	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/helpers/activities_helper.rb	2013-11-19 16:46:06 UTC (rev 3800)
@@ -73,10 +73,12 @@
     context_bits = []
     context_vars = []
 
-    if opts[:context]
-      context_bits << "(activities.context_type = ? AND activities.context_id = ?)"
-      context_vars << opts[:context].class.name
-      context_vars << opts[:context].id
+    if opts[:contexts]
+      opts[:contexts].each do |context|
+        context_bits << "(activities.context_type = ? AND activities.context_id = ?)"
+        context_vars << context.class.name
+        context_vars << context.id
+      end
     else
       
     end

Modified: branches/packs/app/models/user.rb (3799 => 3800)


--- branches/packs/app/models/user.rb	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/models/user.rb	2013-11-19 16:46:06 UTC (rev 3800)
@@ -665,6 +665,15 @@
     "#{Conf.base_uri}/users/#{id}"
   end
 
+  def personal_resources_and_subscriptions
+    
+    resources = networks + networks_owned + workflows + blobs + packs
+
+    resources += subscriptions.map { |subscription| subscription.objekt }
+
+    resources.uniq - [nil]
+  end
+
 protected
 
   # clean up emails and username before validation

Modified: branches/packs/app/views/home/index.rhtml (3799 => 3800)


--- branches/packs/app/views/home/index.rhtml	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/views/home/index.rhtml	2013-11-19 16:46:06 UTC (rev 3800)
@@ -1,19 +1,7 @@
-<div id="home_container">
-	<%= render :partial => 'stats' %>
-	
-	<div class="left">
-		<%= render :partial => "announcements" %>
-		<%= render :partial => "latest_groups" %>
-		<%= render :partial => "latest_tags" %>
-	</div>
-	
-	<div class="right">
-		<%= render :partial => "news" %>
-		<%= render :partial => "updated_items" %>
-		<%= render :partial => "new_users" %>
-		<%= render :partial => "latest_reviews" %>
-		<%= render :partial => "latest_comments" %>
-	</div>
-	
-	<div class="clearer">&nbsp;</div>
+<h1>Activity</h1>
+
+<% activities = activities_for_feed(:contexts => logged_in? ? current_user.personal_resources_and_subscriptions : [], :user => current_user) %>
+
+<div id="activities">
+  <%= render(:partial => "activities/list", :locals => { :activities => activities, :user => current_user, :enable_feature => false } ) -%>
 </div>

Modified: branches/packs/app/views/networks/show.rhtml (3799 => 3800)


--- branches/packs/app/views/networks/show.rhtml	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/views/networks/show.rhtml	2013-11-19 16:46:06 UTC (rev 3800)
@@ -109,7 +109,7 @@
 
       <br />
 
-      <% activities = activities_for_feed(:context => @network, :user => current_user) %>
+      <% activities = activities_for_feed(:contexts => address@hidden, :user => current_user) %>
 
       <div id="activities">
         <%= render(:partial => "activities/list", :locals => { :context => @network, :activities => activities, :user => current_user, :enable_feature => true } ) -%>

Modified: branches/packs/app/views/packs/show.rhtml (3799 => 3800)


--- branches/packs/app/views/packs/show.rhtml	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/app/views/packs/show.rhtml	2013-11-19 16:46:06 UTC (rev 3800)
@@ -238,7 +238,7 @@
 
 <!-- END tabs -->
 
-<% activities = activities_for_feed(:context => @pack, :user => current_user) %>
+<% activities = activities_for_feed(:contexts => address@hidden, :user => current_user) %>
 
 <h1>Activities</h1>
 <div id="activities">

Modified: branches/packs/config/routes.rb (3799 => 3800)


--- branches/packs/config/routes.rb	2013-11-19 15:30:52 UTC (rev 3799)
+++ branches/packs/config/routes.rb	2013-11-19 16:46:06 UTC (rev 3800)
@@ -99,6 +99,9 @@
     workflow.resources :previews
     workflow.resources :comments, :collection => { :timeline => :get }
     workflow.resource  :subscription
+    workflow.resources :activities, :member => { :feature => [:put, :delete] } do |activity|
+      activity.resources :comments
+    end
   end
 
   # workflow redirect for linked data model
@@ -158,6 +161,9 @@
     #blob.resources :reviews
     blob.resources :comments, :collection => { :timeline => :get }
     blob.resource  :subscription
+    blob.resources :activities, :member => { :feature => [:put, :delete] } do |activity|
+      activity.resources :comments
+    end
   end
 
   # services

reply via email to

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