-
Notifications
You must be signed in to change notification settings - Fork 307
How to add new activity objects
Social Stream allows developers to write and integrate custom models in the social network.
Social Stream components already provide your application with the most popular activity objects (for instance social_stream-documents
provides with files, pictures, audio and video support) These gems automatically integrate new activity objects with the rest of Social Stream, in the wall form, the search engine, etc.
Just include the desired components in your Gemfile.
Besides, some aspects can be customized in the file config/initializers/social_stream.rb
, which should be copied to your application in the install rake task, and should look like https://github.com/ging/social_stream/blob/master/base/lib/generators/social_stream/base/templates/initializer.rb
For adding new features on social_stream, remember:
-
All activity object models should
include SocialStream::Models::Object
and include anactivity_object_id
integer field in their table. -
If you want to create new object from the wall input, you must add the object to
config/initializers/social_stream.rb
and create a view inapp/views/my_models/_new_activity.html.erb
. Take a look at linkser example at https://github.com/ging/social_stream/blob/master/linkser/app/views/links/_new_activity.html.erb -
Once you create the activity object, it is necessary that you write some views for showing new objects in timeline, search engine, repository etc...
- Firstly, you must include it in
config/initializers/social_stream.rb
so they are included in the views. See the application'config/initializers/social_stream.rb
for more details. - Finally, you must create the appropiate views. You can use the views under in the linkser gem as reference for building your own views: https://github.com/ging/social_stream/tree/master/linkser/app/views/links
Current views are:
-
app/views/my_objects/_timeline.html.erb
shows the object in the activities timeline -
app/views/my_objects/_quick_search_result.html.erb
the object in the search hints from the header -
app/views/my_objects/_search_result.html.erb
the object in the full search result -
app/views/my_objects/_my_object.erb
the object in the repository
-
- Firstly, you must include it in