diff --git a/app/helpers/interim_stream_hackiness_helper.rb b/app/helpers/interim_stream_hackiness_helper.rb index 22186c9b8..29f71ebff 100644 --- a/app/helpers/interim_stream_hackiness_helper.rb +++ b/app/helpers/interim_stream_hackiness_helper.rb @@ -19,4 +19,16 @@ module InterimStreamHackinessHelper nil end end + + def from_group(post) + if params[:controller]== 'soups' + @stream.post_from_group(post) + else + nil + end + end + + def what_soup_sentence(post) + from_group(post).map{|x| x.to_s.gsub("_soup", '').gsub('_',' ').titleize}.to_sentence + end end diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml index f66f3099a..eb8ba638b 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.html.haml @@ -3,7 +3,7 @@ -# the COPYRIGHT file. -.stream_element{:id => post.guid} +.stream_element{:id => post.guid, :class => from_group(post)} .right.controls - if current_user && post.author.owner_id == current_user.id = link_to image_tag('deletelabel.png'), post_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete stream_element_delete", :title => t('delete') @@ -17,10 +17,9 @@ %p = t('share_visibilites.update.see_it_on_their_profile', :name => person_link(post.author)).html_safe = link_to t('undo'), share_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true - + .indicator{:title => "from #{what_soup_sentence(post)}"} .sm_body = person_image_link(post.author, :size => :thumb_small) - .content %div.post_initial_info %span.from diff --git a/lib/stream/base.rb b/lib/stream/base.rb index 37f1b2690..fac8a2970 100644 --- a/lib/stream/base.rb +++ b/lib/stream/base.rb @@ -29,6 +29,10 @@ class Stream::Base post_is_from_contact?(post) end + def post_from_group(post) + nil + end + # @return [String] def title 'a title' diff --git a/lib/stream/soup.rb b/lib/stream/soup.rb index df4f04fed..9bfcc5eb6 100644 --- a/lib/stream/soup.rb +++ b/lib/stream/soup.rb @@ -13,7 +13,7 @@ class Stream::Soup < Stream::Base def posts @posts ||= lambda do - post_ids = aspect_posts_ids + followed_tag_ids + mentioned_post_ids + post_ids = aspects_post_ids + followed_tags_post_ids + mentioned_post_ids post_ids += community_spotlight_post_ids if include_community_spotlight? Post.where(:id => post_ids).for_a_stream(max_time, order) end.call @@ -23,18 +23,32 @@ class Stream::Soup < Stream::Base false end + #emits an enum of the groups which the post appeared + # :spotlight, :aspects, :tags, :mentioned + def post_from_group(post) + [:community_spotlight, :aspects, :followed_tags, :mentioned].collect do |source| + is_in?(source, post) + end.compact + end + private + def is_in?(sym, post) + if self.send("#{sym.to_s}_post_ids").find{|x| x == post.id} + "#{sym.to_s}_soup".to_sym + end + end + def include_community_spotlight? false end - def aspect_posts_ids - @aspect_posts_ids ||= user.visible_shareable_ids(Post, :limit => 15, :order => "#{order} DESC", :max_time => max_time, :all_aspects? => true, :by_members_of => aspect_ids) + def aspects_post_ids + @aspects_post_ids ||= user.visible_shareable_ids(Post, :limit => 15, :order => "#{order} DESC", :max_time => max_time, :all_aspects? => true, :by_members_of => aspect_ids) end - def followed_tag_ids - @followed_tag_ids ||= ids(StatusMessage.tag_stream(user, tag_array, max_time, order)) + def followed_tags_post_ids + @followed_tags_ids ||= ids(StatusMessage.tag_stream(user, tag_array, max_time, order)) end def mentioned_post_ids @@ -47,7 +61,7 @@ class Stream::Soup < Stream::Base #worthless helpers def community_spotlight_person_ids - Person.community_spotlight.select('id').map{|x| x.id} + @community_spotlight_person_ids ||= Person.community_spotlight.select('id').map{|x| x.id} end def tag_array diff --git a/public/javascripts/pages/soups-index.js b/public/javascripts/pages/soups-index.js index 989d1e95b..2055954d3 100644 --- a/public/javascripts/pages/soups-index.js +++ b/public/javascripts/pages/soups-index.js @@ -5,5 +5,8 @@ Diaspora.Pages.SoupsIndex = function() { self.aspectNavigation = self.instantiate("AspectNavigation", document.find("ul#aspect_nav")); self.stream = self.instantiate("Stream", document.find("#aspect_stream_container")); self.infiniteScroll = self.instantiate("InfiniteScroll"); + + + $('.indicator').tipsy({fade: true}); }); }; diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index abbad7ea4..23fa7af9c 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -3493,3 +3493,22 @@ ul#getting_started :margin-top -28px :color #999 :padding-right 9px + +.indicator + :margin-top -15px + :width 14px + :height 4px + :float right + +.aspects_soup + .indicator + :background-color red +.community_spotlight_soup + .indicator + :background-color green +.mentioned_soup + .indicator + :background-color blue +.followed_tags_soup + .indicator + :background-color yellow