social_connections 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +32 -3
- data/lib/app/views/social_activities/_social_activity.html.erb +23 -0
- data/lib/social_connections/version.rb +1 -1
- data/lib/social_connections.rb +6 -0
- metadata +21 -20
data/README.md
CHANGED
@@ -7,8 +7,7 @@ Enables
|
|
7
7
|
* Activities on those things which are recorded for later processing
|
8
8
|
* Digest mechanism to digest those activities, e.g. for daily digest emails.
|
9
9
|
|
10
|
-
This gem is work in progress and my playground,
|
11
|
-
|
10
|
+
This gem is work in progress and my playground, use at own risk.
|
12
11
|
|
13
12
|
Setup
|
14
13
|
-----
|
@@ -25,7 +24,6 @@ and run
|
|
25
24
|
|
26
25
|
bundle install
|
27
26
|
|
28
|
-
|
29
27
|
Next, you need to add the migration by using the install generator of the gem:
|
30
28
|
|
31
29
|
rails g social_connections:install
|
@@ -102,6 +100,37 @@ The view (e.g. `app/views/books/show.html.erb`) may then contain the following '
|
|
102
100
|
<%= link_to('I like this', current_user_likes_book_path(@book) %>
|
103
101
|
|
104
102
|
|
103
|
+
Views
|
104
|
+
-----
|
105
|
+
|
106
|
+
A list of social activities can be rendered by
|
107
|
+
|
108
|
+
<%= render @social_activities %>
|
109
|
+
|
110
|
+
in a view. Thereby, '@social_activities' could have been assigned in a controller like this:
|
111
|
+
|
112
|
+
def show
|
113
|
+
@user = User.find(params[:id])
|
114
|
+
@social_activities = SocialConnections.aggregate(@user).activities
|
115
|
+
end
|
116
|
+
|
117
|
+
Rendering uses a generic partial (part of the gem) which in turn renders the subject and
|
118
|
+
target as partial, and the verb as text.
|
119
|
+
If the subject is of type 'User', then
|
120
|
+
you have to provide a partial in 'app/views/users/_user.html.erb' (if
|
121
|
+
using erb). Check [Rails Guides on partials](http://guides.rubyonrails.org/layouts_and_rendering.html#using-partials)
|
122
|
+
on details for this. A simple example for a '_user.html.erb' file is:
|
123
|
+
|
124
|
+
User <%= link_to user.name, user %>
|
125
|
+
|
126
|
+
If you want to use your own template for rendering the SocialActivity, you can
|
127
|
+
pass a reference to your template as an option when creating the activity:
|
128
|
+
|
129
|
+
u.comments(b, :comment => 'awesome book!', :template => 'social_activities/user_comments_user')
|
130
|
+
|
131
|
+
For this, provide a partial at 'app/views/social_activities/_user_comments_user.html.erb'.
|
132
|
+
|
133
|
+
|
105
134
|
How to run the Tests (in the gem itself, not in your Rails app)
|
106
135
|
--------------------
|
107
136
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<li>
|
2
|
+
<% if social_activity.options['template'].blank? %>
|
3
|
+
<div class="social-activity">
|
4
|
+
<% if social_activity.subject.nil? %>
|
5
|
+
(gone)
|
6
|
+
<% else %>
|
7
|
+
<%= render social_activity.subject %>
|
8
|
+
<% end %>
|
9
|
+
<%= social_activity.verb %>
|
10
|
+
<% if social_activity.target.blank? %>
|
11
|
+
(gone)>
|
12
|
+
<% else %>
|
13
|
+
<%= render social_activity.target %>
|
14
|
+
<% end %>
|
15
|
+
<div class="when">
|
16
|
+
<%= time_ago_in_words social_activity.created_at %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<% else %>
|
20
|
+
<%= render :partial => social_activity.options['template'],
|
21
|
+
:locals => { :social_activity => social_activity } %>
|
22
|
+
<% end %>
|
23
|
+
</li>
|
data/lib/social_connections.rb
CHANGED
@@ -18,5 +18,11 @@ end
|
|
18
18
|
ActiveSupport::Dependencies.autoload_once_paths.delete(path)
|
19
19
|
end
|
20
20
|
|
21
|
+
module SocialConnections
|
22
|
+
class Engine < Rails::Engine
|
23
|
+
paths["app/views"] = "lib/app/views"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
21
27
|
path = File.join(File.dirname(__FILE__), 'tasks')
|
22
28
|
ActiveSupport::Dependencies.autoload_paths << path
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: social_connections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-31 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &2161391360 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2161391360
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sqlite3
|
27
|
-
requirement: &
|
27
|
+
requirement: &2161390780 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2161390780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec-rails
|
38
|
-
requirement: &
|
38
|
+
requirement: &2152319520 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2152319520
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: turn
|
49
|
-
requirement: &
|
49
|
+
requirement: &2152319120 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2152319120
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: factory_girl_rails
|
60
|
-
requirement: &
|
60
|
+
requirement: &2152318720 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2152318720
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activerecord
|
71
|
-
requirement: &
|
71
|
+
requirement: &2152318320 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2152318320
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: actionmailer
|
82
|
-
requirement: &
|
82
|
+
requirement: &2152317920 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2152317920
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: i18n
|
93
|
-
requirement: &
|
93
|
+
requirement: &2152317520 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,10 +98,10 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2152317520
|
102
102
|
- !ruby/object:Gem::Dependency
|
103
103
|
name: pry
|
104
|
-
requirement: &
|
104
|
+
requirement: &2152317120 !ruby/object:Gem::Requirement
|
105
105
|
none: false
|
106
106
|
requirements:
|
107
107
|
- - ! '>='
|
@@ -109,7 +109,7 @@ dependencies:
|
|
109
109
|
version: '0'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
|
-
version_requirements: *
|
112
|
+
version_requirements: *2152317120
|
113
113
|
description: The idea is to provide pluggable social connections, activities and a
|
114
114
|
method to digest those activities (e.g. in daily emails).
|
115
115
|
email:
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/app/models/social_activity.rb
|
134
134
|
- lib/app/models/social_connection.rb
|
135
135
|
- lib/app/views/digest_mailer/digest.html.erb
|
136
|
+
- lib/app/views/social_activities/_social_activity.html.erb
|
136
137
|
- lib/db/migrate/20110516181115_create_social_connections.rb
|
137
138
|
- lib/generators/social_connections/install/install_generator.rb
|
138
139
|
- lib/generators/social_connections/install/templates/create_mute_and_curious_guests.rb
|