particpate stream, yo!
This commit is contained in:
parent
c7d422c338
commit
310a0679f1
10 changed files with 53 additions and 35 deletions
|
|
@ -8,6 +8,8 @@ require File.join(Rails.root, "lib", "stream", "comments")
|
||||||
require File.join(Rails.root, "lib", "stream", "likes")
|
require File.join(Rails.root, "lib", "stream", "likes")
|
||||||
require File.join(Rails.root, "lib", "stream", "mention")
|
require File.join(Rails.root, "lib", "stream", "mention")
|
||||||
require File.join(Rails.root, "lib", "stream", "followed_tag")
|
require File.join(Rails.root, "lib", "stream", "followed_tag")
|
||||||
|
require File.join(Rails.root, "lib", "stream", "participate")
|
||||||
|
|
||||||
|
|
||||||
class StreamsController < ApplicationController
|
class StreamsController < ApplicationController
|
||||||
before_filter :authenticate_user!
|
before_filter :authenticate_user!
|
||||||
|
|
@ -29,6 +31,10 @@ class StreamsController < ApplicationController
|
||||||
stream_responder(Stream::Public)
|
stream_responder(Stream::Public)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def participate
|
||||||
|
stream_responder(Stream::Participate)
|
||||||
|
end
|
||||||
|
|
||||||
def multi
|
def multi
|
||||||
stream_responder(Stream::Multi)
|
stream_responder(Stream::Multi)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,12 @@
|
||||||
|
|
||||||
#followed_tags_listing
|
#followed_tags_listing
|
||||||
= render 'tags/followed_tags_listings'
|
= render 'tags/followed_tags_listings'
|
||||||
|
|
||||||
|
|
||||||
/participation stream
|
%br
|
||||||
|
%ul.left_nav
|
||||||
|
%li
|
||||||
|
= link_to t("streams.participate.title"), participate_stream_path, :class => 'home_selector', :rel => 'backbone'
|
||||||
|
|
||||||
%ul.left_nav.sub
|
%ul.left_nav.sub
|
||||||
%li
|
%li
|
||||||
= link_to t('streams.like_stream.title'), liked_stream_path, :class => 'home_selector', :rel => 'backbone'
|
= link_to t('streams.like_stream.title'), liked_stream_path, :class => 'home_selector', :rel => 'backbone'
|
||||||
|
|
|
||||||
|
|
@ -929,6 +929,8 @@ en:
|
||||||
aspects:
|
aspects:
|
||||||
title: "Your Aspects"
|
title: "Your Aspects"
|
||||||
|
|
||||||
|
participate:
|
||||||
|
title: "Participate"
|
||||||
users:
|
users:
|
||||||
logged_out:
|
logged_out:
|
||||||
signed_out: "You've signed out of Diaspora*"
|
signed_out: "You've signed out of Diaspora*"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ Diaspora::Application.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
# Streams
|
# Streams
|
||||||
|
get "participate" => "streams#participate", :as => "participate_stream"
|
||||||
get "public" => "streams#public", :as => "public_stream"
|
get "public" => "streams#public", :as => "public_stream"
|
||||||
get "stream" => "streams#multi", :as => "multi_stream"
|
get "stream" => "streams#multi", :as => "multi_stream"
|
||||||
get "followed_tags" => "streams#followed_tags", :as => "followed_tags_stream"
|
get "followed_tags" => "streams#followed_tags", :as => "followed_tags_stream"
|
||||||
|
|
|
||||||
|
|
@ -11,16 +11,6 @@ class Stream::Base
|
||||||
self.publisher = Publisher.new(self.user, publisher_opts)
|
self.publisher = Publisher.new(self.user, publisher_opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
# @return [Person]
|
|
||||||
def random_community_spotlight_member
|
|
||||||
@random_community_spotlight_member ||= Person.find_by_diaspora_handle(spotlight_diaspora_id)
|
|
||||||
end
|
|
||||||
|
|
||||||
# @return [Boolean]
|
|
||||||
def has_community_spotlight?
|
|
||||||
random_community_spotlight_member.present?
|
|
||||||
end
|
|
||||||
|
|
||||||
#requied to implement said stream
|
#requied to implement said stream
|
||||||
def link(opts={})
|
def link(opts={})
|
||||||
'change me in lib/base_stream.rb!'
|
'change me in lib/base_stream.rb!'
|
||||||
|
|
|
||||||
15
lib/stream/participate.rb
Normal file
15
lib/stream/participate.rb
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
class Stream::Participate < Stream::Base
|
||||||
|
def link(opts={})
|
||||||
|
Rails.application.routes.url_helpers.participate_stream_path(opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
def title
|
||||||
|
I18n.translate("streams.participate.title")
|
||||||
|
end
|
||||||
|
|
||||||
|
# @return [ActiveRecord::Association<Post>] AR association of posts
|
||||||
|
def posts
|
||||||
|
@posts ||= EvilQuery::Participation.new(user).posts
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
app.Router = Backbone.Router.extend({
|
app.Router = Backbone.Router.extend({
|
||||||
routes: {
|
routes: {
|
||||||
|
"participate": "stream",
|
||||||
"stream": "stream",
|
"stream": "stream",
|
||||||
"aspects:query": "stream",
|
"aspects:query": "stream",
|
||||||
"commented": "stream",
|
"commented": "stream",
|
||||||
|
|
|
||||||
|
|
@ -50,22 +50,19 @@ describe StreamsController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
streams = [
|
streams = {
|
||||||
{:path => :liked, :type => Stream::Likes},
|
:liked => Stream::Likes,
|
||||||
{:path => :mentioned, :type => Stream::Mention},
|
:mentioned => Stream::Mention,
|
||||||
{:path => :followed_tags, :type => Stream::FollowedTag}
|
:followed_tags => Stream::FollowedTag,
|
||||||
]
|
:participate => Stream::Participate
|
||||||
|
}
|
||||||
|
|
||||||
streams.each do |s|
|
streams.each do |stream_path, stream_class|
|
||||||
describe "##{s[:path]}" do
|
describe "a GET to #{stream_path}" do
|
||||||
it 'succeeds' do
|
it 'assigns a stream of the proper class' do
|
||||||
get s[:path]
|
get stream_path
|
||||||
response.should be_success
|
response.should be_success
|
||||||
end
|
assigns[:stream].should be_a stream_class
|
||||||
|
|
||||||
it 'assigns a stream' do
|
|
||||||
get s[:path]
|
|
||||||
assigns[:stream].should be_a s[:type]
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
12
spec/lib/stream/participate_spec.rb
Normal file
12
spec/lib/stream/participate_spec.rb
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
require File.join(Rails.root, 'spec', 'shared_behaviors', 'stream')
|
||||||
|
|
||||||
|
describe Stream::Participate do
|
||||||
|
before do
|
||||||
|
@stream = Stream::Participate.new(alice, :max_time => Time.now, :order => 'updated_at')
|
||||||
|
end
|
||||||
|
|
||||||
|
describe 'shared behaviors' do
|
||||||
|
it_should_behave_like 'it is a stream'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#class Object
|
|
||||||
# def id
|
|
||||||
# if self.class.ancestors.include?(ActiveRecord::Base)
|
|
||||||
# super
|
|
||||||
# else
|
|
||||||
# raise "You are calling id on a non-ActiveRecord object. STOP IT."
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
#end
|
|
||||||
Loading…
Reference in a new issue